#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  long long n, a, f0[101] = {}, f1[101] = {};
  cin >> n >> a;
  long long ans = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < 61; j++) {
      if (a & ((long long)1 << j)) {
        f1[j]++;
      } else {
        f0[j]++;
      }
    }
    cin >> a;
    for (int j = 0; j < 61; j++) {
      if (a & ((long long)1 << j)) {
        ans += ((long long)1 << j) * f0[j];
      } else {
        ans += ((long long)1 << j) * f1[j];
      }
      ans %= MOD;
    }
  }
  cout << ans << endl;
}
