#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long N;
int main() {
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < (N); ++i) cin >> a[i];
  long long sum = 0;
  for (int i = 0; i < (60); ++i) {
    long long x = 0;
    for (int k = 0; k < (N); ++k) {
      if (a[k] >> i & 1) {
        x++;
      }
    }
    long long m = x * (N - x) % mod;
    m = m << i;
    sum += m % mod;
    sum %= mod;
  }
  cout << sum << endl;
}
