Given an array $a$ consisting of $n$ non-negative integers. Count the number of pairs $1 \le i, j \le n$ such that $a_i \le (a_i \oplus a_j) \le a_j$.
### Input
- The first line contains an integer $n$.
- The second line contains $n$ positive integers $a_i$.
### Output
- Print a single integer — the number of valid pairs $i,j$.
### Constraints
- $1 \le n \le 5 \times 10^5$.
- $0 \le a_i < 2^{30}$.
### Example
Input:
```
5
0 1 2 3 4
```
Output:
```
6
```