#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
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 digit = 0; digit <= 60; digit++) {
    long long c0 = 0, c1 = 0;
    for (long long i = 0; i < N; i++) {
      if (1 & (a[i] >> digit))
        c1++;
      else
        c0++;
    }
    ans += c0 * c1 * ((1ll << digit) % MOD);
    ans %= MOD;
  }
  cout << ans << endl;
}
