#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;
typedef long long ll;

const int mod = 1000000007;

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(void) {
  
  int n;
  cin >> n;
  ll a[n];
  rep (i, n) cin >> a[i];

  vector<ll> num(70, 0);

  rep (i, n) rep (j, 66) {
    if (a[i] & (1LL << j)) num[j]++;
  }

  ll ans = 0;

  rep (i, 64) {
    ans += (num[i] * (n - num[i]))%mod * (modpow(2, i, mod))mod;
    ans %= mod;
  }

  cout << ans << endl;
  return 0;
}