#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7ffffff;
const int mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < (60); ++i) {
    long long cnt = 0;
    for (int j = 0; j < (n); ++j) {
      if (a[j] & (1ll << i)) cnt++;
    }
    long long now = (1ll << i) % mod;
    now *= cnt % mod;
    now *= (n - cnt) % mod;
    (ans += now) %= mod;
  }
  cout << ans << endl;
  return 0;
}
