#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, z = 1e9 + 7;
  cin >> N;
  vector<long long> memo(N);
  int bit = 0, temp = 0;
  for (int i = 0; i < N; i++) {
    long long a;
    cin >> a;
    memo.at(i) = a;
    temp = log2(a) + 1;
    bit = max(bit, temp);
  }
  vector<long long> zero(bit, 0), one(bit, 0);
  for (int i = 0; i < N; i++) {
    long long a = memo.at(i);
    for (int j = 0; j < bit; j++) {
      if (a >> j & 1) {
        one.at(j)++;
      } else {
        zero.at(j)++;
      }
    }
  }
  long long ans = 0;
  for (int i = bit - 1; i >= 0; i--) {
    ans *= 2;
    ans += zero.at(i) * one.at(i);
  }
  ans %= z;
  cout << ans << endl;
}
