#include <bits/stdc++.h>
using namespace std;
int freq[63];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long a, MOD = 1000000007LL, tot = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    for (int j = 0; j < 63; ++j) {
      if ((a >> j) & 1) ++freq[j];
    }
  }
  for (long long i = 0; i < 62; ++i) {
    a = freq[i] * (freq[i] - 1) / 2 % MOD;
    tot = (tot + (1LL << i) % MOD * freq[i] * (n - freq[i]) % MOD) % MOD;
  }
  cout << tot << "\n";
}
