#include <bits/stdc++.h>
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double eps = 0.000000001;
using namespace std;
long long keta[70];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; (i) < (n); ++(i)) {
    long long a;
    cin >> a;
    for (long long j = 0; (j) < (63); ++(j)) {
      keta[j] += a % 2;
      a /= 2;
    }
  }
  long long ans = 0;
  long long now_ans = 1;
  for (long long j = 0; (j) < (63); ++(j)) {
    ans += now_ans * keta[j] * (n - keta[j]);
    ans %= MOD;
    now_ans *= 2;
    now_ans %= MOD;
  }
  cout << ans << endl;
}
