#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e18;
const int MX = 1e9 + 7;
int N;
long long sum = 0;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  vector<long long> a(N);
  for (int i = (0); i < (N); ++i) cin >> a[i];
  for (int bits = (0); bits < (64); ++bits) {
    int zc = 0, oc = 0;
    long long idsum = 0;
    for (int j = (0); j < (N); ++j) {
      if (a[j] % 2)
        oc++;
      else
        zc++;
      a[j] /= 2;
    }
    idsum = ((oc % MOD) * (zc % MOD)) % MOD;
    idsum = ((idsum % MOD) * ((1ll << bits) % MOD)) % MOD;
    ;
    sum = ((sum % MOD) + (idsum % MOD)) % MOD;
  }
  cout << sum % MOD;
  return 0;
}
