#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 5e5 + 3;
long long a[N];
long long ans;
long long sum[N];
long long q[N];
inline long long read() {
  long long v = 0, c = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') c = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    v = v * 10 + ch - 48;
    ch = getchar();
  }
  return v * c;
}
inline long long quick(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return res;
}
int main() {
  int n = read();
  q[0] = 1;
  for (int i = 1; i <= n; ++i) {
    a[i] = read();
    for (int j = 0; j < 60; ++j)
      if (a[i] & (1ll << j)) sum[j]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 60; ++j) {
      if (a[i] & (1ll << j))
        ans += 1ll * (n - sum[j]) * (1ll << j) % mod;
      else
        ans += 1ll * sum[j] * (1ll << j) % mod;
      if (ans >= mod) ans -= mod;
    }
  }
  printf("%lld\n", ans * quick(2, mod - 2) % mod);
  return 0;
}
