#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
    constexpr ll mod = 1e9 + 7;
    ll n; cin >> n;
    vector<ll> a(n), b(60, 0);

    REP(i, n) {
        cin >> a[i];
        REP(j, 60) {
            b[j] += (a[i] >> j) & 1;
        }
    }

    ll ans = 0;
    REP(i, 64) {
        ans += (1LL << i) * (b[i] * (n - b[i]) % mod) % mod;
        ans %= mod;
    }

    cout << ans << endl;

    return 0;
}
