#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chmax(T &a, const T &b) {
  if (a < b) a = b;
}
template <class T>
inline void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
const long long INF = 1LL << 60;
const long long MOD = (long long)1e9 + 7;
const long long MAX = (long long)420;
int main(void) {
  long long N;
  cin >> N;
  vector<array<long long, 65>> A(N);
  for (int i = 0; i < (int)(N); i++) {
    long long a;
    cin >> a;
    long long b = a;
    int j = 0;
    while (1) {
      A[i][j] = b % 2;
      b /= 2;
      j++;
      if (j == 65) break;
    }
  }
  array<long long, 65> sum;
  for (int i = 0; i < (int)(65); i++) sum[i] = 0;
  for (int i = 0; i < (int)(65); i++) {
    for (int j = 0; j < (int)(N); j++) {
      sum[i] += A[j][i];
    }
  }
  array<long long, 65> ans;
  for (int i = 0; i < (int)(65); i++) ans[i] = 0;
  for (int i = 0; i < (int)(N); i++) {
    for (int j = 0; j < (int)(65); j++) {
      if (A[i][j])
        ans[j] += N - sum[j];
      else
        ans[j] += sum[j];
    }
  }
  for (int i = 0; i < (int)(65); i++) ans[i] /= 2;
  long long ans2 = 0;
  long long now = 1;
  for (int i = 0; i < (int)(65); i++) {
    ans2 += now * ans[i];
    now *= 2;
    ans2 %= MOD;
    now %= MOD;
  }
  cout << ans2 << endl;
  return 0;
}
