#include <bits/stdc++.h>
using namespace std;
int main() {
  long mod = 1e9 + 7;
  int N;
  cin >> N;
  long A[N];
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  long ans = 0;
  long two = 1;
  for (long i = 0; i < 64; ++i) {
    long tmp = 0;
    for (int j = 0; j < N; ++j) {
      tmp += A[j] >> i & 1;
    }
    ans += two * tmp * (N - tmp) % mod;
    ans %= mod;
    two *= 2;
  }
  cout << ans << endl;
}
