#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < (N); ++i) cin >> A[i];
  int nZero[62];
  for (int i = 0; i < (62); ++i) nZero[i] = 0;
  for (int i = 0; i < (N); ++i) {
    long long a = A[i];
    for (int j = 0; j < (62); ++j) {
      if ((a & 1) == 0) nZero[j]++;
      a = a >> 1;
    }
  }
  long long ans = 0;
  long long m = 1;
  for (int i = 0; i < (62); ++i) {
    long long c = (nZero[i] * (N - nZero[i])) % 1000000007;
    c = (c * m) % 1000000007;
    ans = (ans + c) % 1000000007;
    m = m * 2;
  }
  cout << ans << endl;
  return 0;
}
