#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
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;
  vector<long long> a(n), ze(64, 0), ei(64, 0), ans(64, 0);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    bitset<64> ta = a[i];
    for (int j = 0; j < 64; j++) {
      if (ta.test(j))
        ei[j]++;
      else
        ze[j]++;
    }
  }
  for (long long i = 0; i < n; i++) {
    bitset<64> ta = a[i];
    for (int j = 0; j < 64; j++) {
      if (ta.test(j)) {
        ei[j] -= 1;
        ans[j] = (ans[j] + ze[j]) % mod;
      } else {
        ze[j] -= 1;
        ans[j] = (ans[j] + ei[j]) % mod;
      }
    }
  }
  long long an = 0;
  long long tmp = 1;
  for (int i = 0; i < 64; i++) {
    an += (ans[i] * tmp) % mod;
    an %= mod;
    tmp *= 2;
  }
  cout << an << endl;
}
