#include <bits/stdc++.h>
using namespace std;
int main() {
  long MOD = 1000000007;
  int N;
  cin >> N;
  long pow2[60];
  pow2[0] = 1;
  for (int ii = 1; ii < 60; ii++) {
    pow2[ii] = pow2[ii - 1] * 2 % MOD;
  }
  vector<long> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int ni[60];
  for (int i = 0; i < 60; i++) {
    ni[i] = 0;
  }
  long tmp = 0;
  int count = 0;
  for (int i = 0; i < N; i++) {
    tmp = vec.at(i);
    count = 0;
    while (tmp > 0) {
      if (tmp > 10000000) {
      }
      if (tmp % 2 == 1) ni[count] += 1;
      count += 1;
      tmp = tmp / 2;
    }
  }
  long ans = 0;
  for (int j = 0; j < 60; j++) {
    ans += (ni[j] * (N - ni[j])) * pow2[j];
    ans %= MOD;
  }
  cout << ans % MOD << endl;
}
