Chandrima and XOR
Difficulty: Hard

Chandrima likes the XOR operation very much and keeps finding and solving related problems. One day she comes across a problem and gets stuck on it, which makes her sad. You being her friend decide to help her out by writing a code for the same. 

Consider a list of all natural numbers. Now you remove all numbers whose binary representation has at least two consecutive $1$ bits, from the list, hence generating a new list having elements $1,2,4,5,8,...$ and so on. Now you are given $N$ numbers from this newly generated list. You have to find the XOR of these numbers.

**Input Format**  
The first line has an integer $N$, denoting the number of integers in list $A$.  
The next line contains $N$ space-separated integers. $A_i$ represents the $A_i^{\text{th}}$ number of the generated list. Since the answer can be very large, print the answer modulo $(10^9+7)$.

**Output Format**  
Just print one line containing the final answer.  


**Constraints**  
$1 \le N \le 5\cdot 10^5$  
$1 \le A_i \le 10^{18}$

**Sample Input 1**  

    3
    1 2 3

**Sample Output 1**  

    7

**Sample Input 2**  

    3
    1 3 4

**Sample Output 2**  

    0

**Explanation**  

*Sample 1:*  
The values to be considered are $1,2,4$, and the answer is $1\oplus2\oplus4 = 7$.

*Sample 2:*  
The values to be considered are $1,4,5$, and the answer is $1\oplus4\oplus5 = 0$.


Input Format:

Output Format:

Sample Input:

Sample Output:

Python 3 starter code:
# Complete the solve function below.
def solve(a):




Reference solution (C++):
###C++  
```cpp  
#include <iostream>
#include <vector>
#define pb push_back
using namespace std;
long long mod=1000000007;
vector<long long> fibo,power;
void two_pow()
{
    long long p;
    power.pb(1);
    for(int i=1;i<100;i++)
    {
        power.pb(power[i-1]+power[i-1]);
        if(power[i]>=mod)
            power[i]-=mod;
    }
}
void fib() 
{
    long long o=1,n=1;
    fibo.pb(1);
    while(1)
    {
        n=n+o;
        o=n-o;
        fibo.pb(n);
        if(n>1e18)
            break;
    }
}
int main() 
{
    long long n,inp,cnt,x,ans=0;
    int sol[100];
    fib();
    two_pow();
    for(int i=0;i<100;i++)
        sol[i]=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>inp;
        for(int i=0;i<fibo.size();i++)
        {
            if(fibo[i]>inp)
            {
                cnt=i-1;
                break;
            }
        }
        for(int i=cnt;i>=0;i--)
        {
            if(inp>=fibo[i])
            {
                x=1;
                inp-=fibo[i];
            }
            else
                x=0;
            sol[i]^=x;
        }
    }

    for(int i=0;i<100;i++)
    {
        if(sol[i])
            ans+=power[i];
        if(ans>=mod)
            ans-=mod;
    }
    cout<<ans<<endl;
    return 0;
} 
```