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