#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<int> v;
  long long MOD = 1000000007;
  long long ans = 0;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) cin >> A[i];
  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 += 1;
      A[j] = A[j] >> 1;
    }
    long long zeros = (N - ones) % MOD;
    ans += long long(pow(2, i)) % MOD * ones * zeros;
    ans %= MOD;
  }
  cout << ans << endl;
}
