#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  ll ans = 0;
  for (int i = 0; i < (int)(60); i++) {
    int X = 0, Y = 0;
    for (int j = 0; j < (int)(n); j++) {
      if ((a[j] >> i) & 1) {
        X++;
      } else {
        Y++;
      }
    }
    ll now = X * Y % MOD;
    for (int j = 0; j < (int)(i); j++) {
      now = now * 2 % MOD;
    }
    ans += now;
    ans %= MOD;
  }
  cout << ans << endl;
}
