#include <bits/stdc++.h>
#pragma GCC optimize(2)
const int maxn = 3e5 + 5;
long long seq[maxn];
const long long mod = 1e9 + 7;
long long bin(long long x, long long n) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return ret;
}
int main() {
  int n;
  scanf("%d", &n);
  long long tn;
  for (int i = 1; i <= n; i++) scanf("%lld", &seq[i]);
  long long ret = 0;
  for (int i = 0; i < 60; ++i) {
    long long cnt = 0;
    for (int j = 1; j <= n; ++j) {
      if ((seq[j] >> i) & 1) {
        cnt++;
      }
    }
    ret = (ret + bin(2, i) * (cnt) * (n - cnt)) % mod;
  }
  printf("%lld\n", ret);
}
