#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;
long long pow(long long x, long long n) {
  long long res = 1;
  if (n > 0) {
    res = pow(x, n / 2);
    if (n % 2 == 0) {
      res = (res * res) % mod;
    } else {
      res = (((res * res) % mod) * x) % mod;
    }
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < (int)(61); i++) {
    long long o = 0, z = 0;
    for (int j = 0; j < (int)(n); j++) {
      if (a[j] & (1LL << i))
        o++;
      else
        z++;
    }
    ans += ((o * z * pow((long long)2, (long long)i)) % mod);
    ans %= mod;
  }
  cout << ans << endl;
}
