#include <bits/stdc++.h>
using namespace std;
using Int = long long;
const Int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<Int> A(N);
  for (auto &a : A) cin >> a;
  vector<Int> TWO(60);
  TWO[0] = 1;
  for (int i = 1; i < 60; i++) {
    TWO[i] = (TWO[i - 1] * 2) % MOD;
  }
  Int ans = 0;
  for (int i = 0; i < 60; i++) {
    Int d = 1LL << i;
    int cnt = 0;
    for (auto a : A)
      if (a & d) cnt++;
    ans = (ans + TWO[i] * cnt * (N - cnt)) % MOD;
  }
  cout << ans << endl;
  return 0;
}
