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