#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
long long n;
int main() {
  cin >> n;
  vector<long long> v(n, 0);
  for (int i = 0; i < (n); i++) cin >> v[i];
  vector<long long> a0(70, 0), a1(70, 0);
  long long sum = 0;
  for (int i = 0; i < (61); i++) {
    for (int j = 0; j < (n); j++) {
      long long copy = v[j];
      copy = (copy >> i);
      if (copy % 2 == 1)
        a1[i]++;
      else
        a0[i]++;
    }
  }
  for (int i = 0; i < (61); i++) {
    long long wa = (((1 << i) % MOD) * a0[i] % MOD * a1[i] % MOD) % MOD;
    sum += wa;
    sum %= MOD;
  }
  cout << sum << endl;
  return 0;
}
