#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long N, mod = 1000000007;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];
  long long ans = 0;
  for (long long i = 0; i < 60; ++i) {
    long long ones = 0;
    for (long long j = 0; j < N; ++j) {
      if (A[j] & 1) ++ones;
      A[j] >>= 1;
    }
    long long zeroes = N - ones;
    ans += pow(2, i) * (ones * zeroes);
    ans %= mod;
  }
  cout << ans;
  return 0;
}
