#include <bits/stdc++.h>
using namespace std;
long long ch[63];
long long a[300010];
long long ans[63];
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    long long now = a[i];
    vector<long long> k;
    while (now != 0) {
      k.push_back(now % 2);
      now /= 2;
    }
    for (long long j = 0; j < k.size(); j++) {
      if (k[j] == 1) {
        ch[j]++;
      }
    }
  }
  for (long long i = 0; i < n; i++) {
    long long now = a[i];
    long long j = 0;
    while (j <= 62) {
      if (now % 2 == 1) {
        ans[j] += n - ch[j];
      } else {
        ans[j] += ch[j];
      }
      now /= 2;
      j++;
    }
  }
  for (long long i = 0; i <= 62; i++) {
    ans[i] /= 2;
  }
  long long cnt = 0;
  for (long long i = 0; i <= 62; i++) {
    long long keta = modpow(2, i, 1000000007);
    long long now = ans[i] * keta;
    now %= 1000000007;
    cnt += now;
    cnt %= 1000000007;
  }
  cout << cnt;
  return 0;
}
