#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const int MAX = 510000;
const long long MOD = 1000000007;
long long roundd(long long x, long long n) {
  if (x > n) {
    return x % n;
  } else if (x < 0) {
    return x % n + n;
  } else
    return x;
}
bool isprime(long long n) {
  if (n == 1) return false;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
long long modpow(long long x, long long n) {
  long long r = 1;
  while (n) {
    if (n & 1) r = r * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return r;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  vector<vector<long long> > cnt(60, vector<long long>(2, 0));
  for (long long i = (0); i < (n); ++i) {
    cin >> a[i];
  }
  for (long long i = (0); i < (n); ++i) {
    for (long long j = (0); j < (60); ++j) {
      if (a[i] >> j & 1)
        cnt[j][1]++;
      else
        cnt[j][0]++;
    }
  }
  long long ans = 0;
  for (long long i = (0); i < (60); ++i) {
    ans += (modpow(2, i) * (cnt[i][0] * cnt[i][1]) % MOD) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
