#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e+9 + 7;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (int)(N); ++i) cin >> A[i];
  long long ans = 0;
  for (int i = 0; i < 60; ++i) {
    long long count = 0;
    for (int j = 0; j < (int)(N); ++j) {
      if (A[j] & ((long long)1 << i)) ++count;
    }
    ans += count * (N - count) % MOD * ((long long)1 << i) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
