#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];
  vector<int> cnt(60, 0);
  long long const MOD = 1000000007;
  long long res = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < 60; ++j) {
      if ((A[i] >> j) & 1) {
        res = (res + (i - cnt[j]) * (1LL << j) % MOD) % MOD;
        cnt[j] += 1;
      } else {
        res = (res + cnt[j] * (1LL << j) % MOD) % MOD;
      }
    }
  }
  cout << res << endl;
}
