#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long MOD = 1000000007;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int ii = 0; ii < N; ++ii) {
    cin >> A[ii];
  }
  long long ans = 0;
  vector<long long> digZero(61);
  vector<long long> digOne(61);
  for (int ii = 0; ii < N; ++ii) {
    long long keta = 0;
    long long val = 1;
    for (int jj = 0; jj < 61; ++jj) {
      long long tmp = A[ii] & 1;
      if (tmp == 0) {
        ans = (ans + val * digOne[keta]) % MOD;
        digZero[keta] = (digZero[keta] + 1) % MOD;
      } else {
        ans = (ans + val * digZero[keta]) % MOD;
        digOne[keta] = (digOne[keta] + 1) % MOD;
      }
      val *= 2;
      keta++;
      A[ii] /= 2;
    }
  }
  cout << ans << "\n";
  return 0;
}
