// Xor Sum 4
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll INF=1e9+7;

vector<ll> XOR(vector<ll> a, vector<ll> b){
    while(true){
        if(a.size()>b.size()){b.push_back(0);}
        else if(a.size()<b.size()){a.push_back(0);}
        else{break;}
    }
    vector<ll> c;
    for(ll i=0; i<a.size(); i++){
        if(a[i]==b[i]){c.push_back(0);}
        else{c.push_back(1);}
    }
    return c;
}

vector<ll> two(ll x){
    vector<ll> y;
    while(x<0){
        if(x==1 || x==0){y.insert(y.begin(),x); break;}
        y.insert(y.begin(), x%2);
        x/=2;
    }
    return y;
}

ll ten(vector<ll> x){
    ll y=0;
    ll two=1;
    for(int i=0; i<x.size(); i++){
        y+=x[i]*two;
        two*=2;
    }
    return y;
}

int main(){
    ll n; cin >> n;
    ll sum=0;
    vector<ll> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    vector<vector<ll>> b(n);
    for(int i=0; i<n; i++){
        b[i].emplace_back(two(a[i]));
    }
    for(int i=1; i<=(n-1); i++){
        for(int j=(i+1); j<=n; j++){
            sum+=ten(XOR(b[i], b[j]));
        }
    }
    cout << sum%INF << endl;
    return 0;
}