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