#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long MOD = 1e9 + 7;
const long long LLINF = 1LL << 60;
const int MAX_N = 3 * 1e5 + 1;
long long N;
long long A[MAX_N];
long long cnt[MAX_N][61];
long long sumCnt[61];
void initCnt() {
  for (int i = 0; i < (int)(N); i++) {
    int j = 0;
    while (A[i] > 0) {
      cnt[i][j] = (A[i] % 2LL);
      A[i] /= 2LL;
      ++j;
    }
  }
}
int main() {
  cin >> N;
  for (int i = 0; i < (int)(N); i++) cin >> A[i];
  initCnt();
  for (int i = 0; i < (int)(N); i++) {
    for (int j = 0; j < (int)(61); j++) {
      sumCnt[j] += cnt[i][j];
    }
  }
  long long ans = 0LL;
  for (long long i = 0; i < N - 1; ++i) {
    for (int j = 0; j < (int)(61); j++) {
      sumCnt[j] -= cnt[i][j];
    }
    for (int j = 0; j < (int)(61); j++) {
      if (cnt[i][j] == 1) {
        ans = (ans + ((1LL << j) * (N - i - 1LL - sumCnt[j])) % MOD) % MOD;
      } else {
        ans = (ans + ((1LL << j) * (sumCnt[j])) % MOD) % MOD;
      }
    }
  }
  cout << ans << endl;
}
