#include <bits/stdc++.h>
using namespace std;

const int N = 1e6 + 5;
const int mod = 1e9 + 7;

int n;
long long cnt[61];
long long a[N], ans;

int main(){



    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 1; i <= n; ++i){
        for (int j = 0; j <= 60; ++j){
            if ((a[i] & (1ll << j)) == 0) continue;
            else ++cnt[j];
        }
    }
    for (int i = 1; i <= n; ++i){
        for (int j = 0; j <= 60; ++j){
            if ((a[i] & (1ll << j)) == 0) ans = (ans + ((1ll << j) % mod) * cnt[j]) % mod) % mod;
           // else ++cnt[j];
        }
    }
    //for (int j = 0; j < 60; ++j) cout << j << ' ' << cnt[j] << '\n';
    cout << ans;

}
