#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
signed main() {
  long long N;
  cin >> N;
  vector<bitset<60>> A(N);
  for (long long i = 0; i < (long long)(N); i++) {
    long long t;
    cin >> t;
    A[i] = t;
  }
  long long res = 0, bit = 1;
  for (long long i = 0; i < (long long)(60); i++) {
    long long one = 0;
    for (long long j = 0; j < (long long)(N); j++) {
      if (A[j][i]) one++;
    }
    long long delta = (N - one) * one * bit % MOD;
    res += delta % MOD;
    bit <<= 1;
    bit %= MOD;
  }
  cout << res % MOD << endl;
  return 0;
}
