#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long power(long long x, long long y) {
  long long res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = ((res % mod) * (x % mod)) % mod;
    y = y >> 1;
    x = ((x % mod) * (x % mod)) % mod;
  }
  return res;
}
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long i = 0; i <= 61; i++) {
    long long h[2] = {0};
    for (long long j = n - 1; j >= 0; j--) {
      h[(a[j] >> i) & 1]++;
    }
    for (long long j = 0; j < n; j++) {
      h[(a[j] >> i) & 1]--;
      ans = (ans + (power(2, i) * h[1 ^ ((a[j] >> i) & 1)]) % mod) % mod;
    }
  }
  cout << ans << '\n';
  return 0;
}
