Given an array a consisting of n non-negative integers. Count the number of pairs 1≤i,j≤n such that ai≤(ai⊕aj)≤aj.
### Input
- The first line contains an integer n.
- The second line contains n positive integers ai.
### Output
- Print a single integer — the number of valid pairs i,j.
### Constraints
- 1≤n≤5×105.
- 0≤ai<230.
### Example
Input:
501234
Output:
6