#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < (int)(61); i++) {
    long long o = 0, z = 0;
    for (int j = 0; j < (int)(n); j++) {
      if (a[j] & (1LL << i))
        o++;
      else
        z++;
    }
    long long cnt = o * z;
    ans += (cnt * ((1LL << i) % mod) % mod) % mod;
    ans %= mod;
  }
  cout << ans % mod << endl;
}
