#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  long long ans = 0;
  long long d = 1;
  for (int i = 0; i < (61); ++i) {
    int cnt = 0;
    for (int j = 0; j < (N); ++j) {
      if (A[j] >> i & 1) cnt++;
    }
    ans += (long long)cnt * (N - cnt) % MOD * d % MOD;
    ans %= MOD;
    d *= 2;
  }
  cout << ans << endl;
}
