A. Osama hates the Corridor of Bits (Red)
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Osama walks into a room filled with a row of glowing numbers, each one a reflection of his thoughts and memories.

The array is of length $$$n$$$, and the numbers are $$$a_1, a_2, \dots, a_n$$$, each shining with its own intensity.

He notices that each number shines with only a few glowing bits. Moreover, some pairs of numbers resonate with each other in a special way.

A pair of indices $$$(i, j)$$$ with $$$i \lt j$$$ is called beautiful if the bitwise OR of $$$a_i$$$ and $$$a_j$$$ is strictly greater than their bitwise XOR $$$\oplus$$$.

Formally, a pair $$$(i, j)$$$ is beautiful if:

$$$$$$ a_i \,|\, a_j \gt a_i \,XOR\, a_j $$$$$$

Osama wonders how many of these beautiful pairs exist in the array, each one a small moment of harmony amidst the glow.

Your task is to count all such beautiful pairs in the array.

Input

The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the length of the array.

The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array.

Osama guarantees that the number of set bits (ones) in the binary representation of each number $$$a_i$$$ does not exceed $$$5$$$.

Output

Print a single integer — denotes the number of beautiful pairs asked.

Examples
Input
3
3 5 6
Output
3
Input
5
7 7 7 7 7
Output
10
Note

In the first example:

Pair ($$$1, 2$$$): $$$3 | 5 = 7$$$, $$$3 \oplus 5 = 6$$$. Since $$$7 \gt 6$$$, this is beautiful.

Pair ($$$1, 3$$$): $$$3 | 6 = 7$$$, $$$3 \oplus 6 = 5$$$. Since $$$7 \gt 5$$$, this is beautiful.

Pair ($$$2, 3$$$): $$$5 | 6 = 7$$$, $$$5 \oplus 6 = 3$$$. Since $$$7 \gt 3$$$, this is beautiful.

All $$$3$$$ pairs are beautiful.