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

signed main(){
    int N; cin >> N;
    vector<ll> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];
    ll ans = 0;
    for(int digit = 0; digit <= 60; digit++){
        int c0 = 0, c1 = 0;
        for(int i = 0; i < N; i++){
            if(1 & (a[i] >> digit)) c1++;
            else c0++;
        }
        ll tmp = (1ll << digit) % MOD;
        int c = c0 * c1 %MOD;
        tmp = tmp * c % MOD;
        ans += tmp;
        ans %= MOD;
    }
    cout << ans << endl;
}
