#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1e9 + 7;
long long mod_pow(long long x, long long n, long long m) {
  if (n == 0) return 1;
  long long res = mod_pow(x * x % m, n / 2, m);
  if (n % 2 == 1) res = res * x % m;
  return res;
}
signed main() {
  long long N;
  cin >> N;
  vector<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 < 60; i++) {
    long long cnt0 = 0, cnt1 = 0;
    for (long long j = 0; j < N; j++) {
      if ((A[j] & (1LL << i)) > 0) {
        cnt1++;
      } else {
        cnt0++;
      }
    }
    ans += (mod_pow(2, i, MOD) * (cnt1 * cnt0) % MOD) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
