#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int K = 60;
long long n;
vector<long long> a;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  a.resize(n);
  for (int i = (0); i < (n); ++i) {
    cin >> a[i];
  }
  long long ret = 0;
  long long d = 1;
  for (long long i = 0; i < K; ++i) {
    long long x = 0;
    for (int j = (0); j < (n); ++j) {
      if (a[j] & 1) {
        x++;
      }
      a[j] = a[j] >> 1;
    }
    long long loc = x * (n - x) % MOD;
    loc *= d;
    loc %= MOD;
    ret += loc;
    ret %= MOD;
    d *= 2;
  }
  cout << ret << endl;
  return 0;
}
