#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
#define OUT(n) cout << (n) << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
constexpr int MOD = 1000000007;

int mod(const ll &x){
    return x > 0 ? x % MOD : (x+MOD) % MOD;
}

int modm(const ll &x,const ll &m){
    return x * m % MOD;
}

int modpow(ll x, ll p) {
    int ret = 1;
    while(p > 0) {
        if (p & 1) ret = modm(ret,x);
        x = modm(x,x);
        p >>= 1;
    }
    return ret;
}

// x * modinv(d)
int modd(ll x,ll d) {
    return modm(x,modpow(d,MOD-2));
}

int main(void)
{
    IOS
    constexpr int N = 62;
    int n; cin >> n;
    vector<bitset<N>> v;
    vector<int> c1(N) , c0(N);
    REP(i,n) {
        ll x;
        cin >> x;
        v.push_back(bitset<N>(x));
        REP(j,N) {
            if(v[i][j]) c1[j]++;
            else c[0]++;
        }
    }

    int ans = 0;
    REP(i,n-1) {
        REP(j,N) {
            if(v[i][j]) c1[j]--;
            else c0[j]--;
        }
        bitset<N> bs(v[i]);
        ll tmp = 0;
        REP(j,N) {
            if (bs[j]) tmp = mod(tmp + modm(mod(1LL << j),c0[j]));
            else tmp = mod(tmp + modm(mod(1LL << j),c1[j]));
        }
        ans = mod(ans + tmp);
    }

    cout << ans << endl;

    return 0;
}
