#include <bits/stdc++.h>
using namespace std;
long long modinv(long long a, long long m = 1000000007) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long N;
long long A[300001];
void set_data() {
  cin >> N;
  for (int i = 0; i < 300001; i++) A[i] = 0;
  for (int i = 0; i < N; i++) cin >> A[i];
  return;
}
int main() {
  set_data();
  long long ans = 0;
  long long tmp = 1;
  for (long long j = 0; j < 61; j++) {
    long long One = 0, Zero = 0;
    for (long long i = 0; i < N; i++) {
      if (((1ll << j) & A[i])) {
        One++;
      } else
        Zero++;
    }
    long long k = (tmp * One * Zero) % 1000000007;
    ans += k %= 1000000007;
    tmp *= 2;
    tmp %= 1000000007;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
