#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define debug(x) cout << #x << " = " << x << '\n'
#define debug_arr(a , n) for(int i = 0 ; i < n ; i++)cout << a[i] << " "
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll> 
#define inf 1000000000
#define mod 1000000007

const int max_n = 1e5 + 9;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a);
        a = (a*a);
        b >>= 1;
    }
    return prod;
}

int main()
{
    int n;
    cin >> n;
    ll a[n];
    for(int i = 0 ; i < n ; i++)
    {
        cin >> a[i];
    }

    int cnt = 0;
    ll sum = 0;
    ll num = 1;
    for(ll i = 0 ; i < 60 ; i++)
    {
        map<int,int> m1;
        for(int j = 0 ; j < n ; j++){
            if(a[j] & (power(2ll , i)))m1[1]++;
            else m1[0]++;
        }

        // debug(i);
        // cout << m1[0] << " " << m1[1] << endl;
        ll prod = m1[0] * m1[1];
        prod += cnt;
        cnt = prod / 2;
        // debug(prod);
        if(prod%2 == 1)sum = (sum%mod + num%mod)%mod;
        num *= 2ll;
    }
    while(cnt != 0){
        if(cnt%2 == 1){
            sum = (sum%mod + num%mod)%mod;
        }
        cnt /= 2; 
        num *= 2ll;
    }
    cout << sum << endl;
}