#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  long long one[60] = {};
  for (int i = 0; i < N; i++) {
    long long A;
    cin >> A;
    for (int j = 0; j < 60; j++) {
      if ((A & ((long long)1 << j)) > 0) one[j]++;
    }
  }
  long long result = 0;
  long long d = 1;
  for (int i = 0; i < 60; i++) {
    result += (one[i] * (N - one[i]) * d) % MOD;
    result %= MOD;
    d = (2 * d) % MOD;
  }
  cout << result << endl;
}
