Each circuit card occupies a set of signal lines, encoded as a bitmask: bit b is 1 when the card uses line b. Two cards can be slotted together only if they share no line, i.e. the bitwise AND of their masks is 0.
Given n card masks, count the number of unordered pairs (i, j) with i < j whose masks are disjoint (mask[i] AND mask[j] == 0).
Input format
Line 1: an integer n.
Line 2: n space-separated integers, the card masks.
Output format
A single integer: the number of disjoint unordered pairs.
Constraints
- 1 <= n <= 100000
- 0 <= each mask <= 1023