#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
const long long MOD = 1e9 + 7;
long long mod_pow(long long x, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long mx = -1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  long long cnt = 0;
  while (mx > 0) {
    cnt++;
    mx /= 2;
  }
  vector<map<long long, long long>> mp(70);
  for (int j = 0; j < n; j++) {
    long long tmp = 0;
    for (int i = 0; i < cnt; i++) {
      long long b = a[j] % 2;
      mp[i][b]++;
      a[j] /= 2;
      tmp++;
    }
  }
  long long ans = 0;
  long long next = 0;
  long long i = 0;
  while (true) {
    long long c = mp[i][0] * mp[i][1];
    ans += mod_pow(2, i, MOD) * ((next + c) % 2);
    ans %= MOD;
    next = (next + c) / 2;
    if (next == 0) break;
    i++;
  }
  cout << ans << endl;
  return 0;
}
