A smart thermostat stores its distinct historical setpoints in a binary search tree. Starting from an empty tree, the setpoints are inserted one at a time in the order given (standard BST insertion: go left when the new value is smaller than the current node, otherwise go right). Given an inclusive band [lo, hi], report how many stored setpoints x satisfy lo <= x <= hi.
Input format
Line 1: an integer n, the number of setpoints.
Line 2: n space-separated distinct integers, the setpoints in insertion order.
Line 3: two space-separated integers lo and hi with lo <= hi.
Output format
A single integer: the count of stored setpoints within [lo, hi].
Constraints
- 1 <= n <= 40
- All setpoints are distinct, each with absolute value <= 1000000.
- -2000000 <= lo <= hi <= 2000000