#include <bits/stdc++.h>
using namespace std;
long long const MOD = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  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_dig = 0; i_dig < 61; i_dig++) {
    long long cnt_1 = 0;
    long long cnt_0 = 0;
    for (long long i = 0; i < n; i++) {
      if (((a[i] >> i_dig) % 2) == 1) {
        cnt_1++;
      } else {
        cnt_0++;
      }
    }
    long long n_comb = cnt_1 * cnt_0;
    long long sum_temp = (((1LL << i_dig)) % MOD) * n_comb;
    sum_temp %= MOD;
    ans = (ans + sum_temp) % MOD;
  }
  cout << ans << endl;
  return 0;
}
