#include <bits/stdc++.h>
using namespace std;
int main(void) {
  const long mod = (long)1e9 + 7;
  int N;
  cin >> N;
  vector<long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long ans = 0;
  for (long d = 0; d < 60; d++) {
    long n0 = 0, n1 = 0;
    for (int i = 0; i < N; i++) {
      if (A[i] & (1L << d))
        n1++;
      else
        n0++;
    }
    ans = ((1L << d % mod) * n1 % mod * n0 % mod + ans) % mod;
  }
  cout << ans << endl;
  return 0;
}
