#include <bits/stdc++.h>
using namespace std;
int N, i, j, mod = 1e9 + 7, ans;
int main() {
  cin >> N;
  vector<long> A(N);
  for (auto& a : A) cin >> a;
  for (i = 0; i < 60; i++) {
    int cnt = 0;
    for (auto a : A) cnt += a >> i & 1;
    cnt = cnt * (N - cnt) % mod;
    for (j = 0; j < i; j++) cnt = cnt * 2 % mod;
    ans += cnt;
  }
  cout << ans % mod << endl;
}
