#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
const int MOD = 1e9 + 7;
const int N = 3e5 + 5;
int n, cnt[70], x[N], ans;
signed main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = n - 1; i >= 0; i--) {
    int ji = 0;
    while (ji <= 61) {
      if (x[i] % 2 == 1) cnt[ji]++;
      ji++;
      x[i] /= 2;
    }
  }
  for (int i = 0; i <= 60; i++) {
    long long int cheng = (cnt[i]) * (n - cnt[i]) % MOD;
    for (int j = 1; j <= i; j++) cheng = cheng * 2 % MOD;
    ans = (ans + cheng) % MOD;
  }
  cout << ans << endl;
}
