#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long MAX = 10000000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (long long i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long primary(long long num) {
  if (num < 2)
    return 0;
  else if (num == 2)
    return 1;
  else if (num % 2 == 0)
    return 0;
  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) {
      return 0;
    }
  }
  return 1;
}
int main() {
  long long N;
  cin >> N;
  vector<long long> x;
  for (int(i) = 0; (i) < (N); (i)++) {
    long long G;
    cin >> G;
    x.push_back(G);
  }
  long long ans = 0, count = 0;
  for (int(j) = 0; (j) < (61); (j)++) {
    count = 0;
    for (int(i) = 0; (i) < (N); (i)++) {
      if (x[i] & 1ll << j) count++;
    }
    long long o = count * (N - count);
    o %= MOD;
    o = (1ll << j) * o % MOD;
    ans += o;
    ans %= MOD;
  }
  cout << ans;
}
