#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e18;
const long long MOD = 1e9 + 7;
long long N;
long long cnt1[100] = {};
int main() {
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long long a;
    cin >> a;
    for (long long j = 0; j < 60; j++) {
      if (a & (1ll << j)) {
        cnt1[j]++;
      }
    }
  }
  long long ans = 0;
  long long tmp = 0;
  for (long long j = 0; j < 60; j++) {
    long long n = cnt1[j] * (N - cnt1[j]) + tmp;
    ans = (ans + ((n % 2) << j)) % MOD;
    tmp = n / 2;
  }
  ans = (ans + tmp % MOD * (1ll << 60) % MOD) % MOD;
  cout << ans << endl;
  return 0;
}
