A sequence of integers is said to be beautiful if the bitwise AND, OR, and XOR of its elements are pairwise equal to each other.
You are given a sequence A of size N. Find the number of non-empty subsequences of A that are beautiful. Print the answer modulo 109+7.
Input format
Output format
In a single line, print the number of non-empty subsequences of A that are beautiful.
Constraints
1≤N≤2⋅1050≤Ai≤109
Here the subsequence {A1,A3,A5} is not beautiful. This is because:
A1&A3&A5=1&2&2=0
A1|A3|A5=1|2|2=3
A1⊕A3⊕A5=1⊕2⊕2=1
For a subsequence to be beautiful, these three values should be equal to each other.
(& represents bitwise AND, | represents bitwise OR, ⊕ represents bitwise XOR)