#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e5 + 5, mod = 1e9 + 7;
long long n, backet1[maxn], backet2[maxn], a[maxn], ans;
inline long long read() {
  long long x = 0, f = 1;
  char p = getchar();
  while (!isdigit(p)) {
    if (p == '-') f = -1;
    p = getchar();
  }
  while (isdigit(p)) x = (x << 3) + (x << 1) + (p ^ 48), p = getchar();
  return x * f;
}
inline long long power(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  for (long long i = 1; i <= n; i++) {
    long long cnt = 0;
    while (1) {
      if (cnt >= 62) break;
      if (a[i] & (1LL << cnt))
        backet1[cnt]++;
      else
        backet2[cnt]++;
      cnt++;
    }
  }
  for (long long i = 1; i <= n; i++) {
    long long cnt = 0;
    while (1) {
      if (cnt >= 62) break;
      if (a[i] & (1LL << cnt))
        ans = (ans + backet2[cnt] * (1LL << cnt)) % mod;
      else
        ans = (ans + backet1[cnt] * (1LL << cnt)) % mod;
      cnt++;
    }
  }
  cout << (ans * power(2, mod - 2) % mod) << endl;
  return 0;
}
