#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 7;
const int maxm = 2e6 + 7;
int Read() {
  int out = 0, flag = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') flag = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    out = out * 10 + c - '0';
    c = getchar();
  }
  return flag * out;
}
long long MOD = 1e9 + 7, cnt[maxn];
int main() {
  long long a, n, ans = 0;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a;
    for (long long j = 0; j < 60; j++) {
      if (a & (1LL << j)) cnt[j]++;
    }
  }
  for (long long i = 0; i < 60; i++) {
    ans =
        (ans + ((cnt[i] * (n - cnt[i])) % MOD * (1LL << i) % MOD) % MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}
