#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  int A = 0, N, pos;
  uint64_t top = 0, zero, one, two = 1;
  cin >> N;
  vector<uint64_t> x(N, 0);
  for (int i = 0; i < (int)N; i++) {
    cin >> x.at(i);
    top = max(top, x.at(i));
    if (top == x.at(i)) pos = i;
  }
  while (x.at(pos) != 0) {
    zero = 0, one = 0;
    for (int i = 0; i < (int)N; i++) {
      (x.at(i) % 2 == 0) ? zero++ : one++;
      x.at(i) /= 2;
    }
    A = (A + (zero * (one * two) % MOD) % MOD) % MOD;
    two = two * 2 % MOD;
  }
  return cout << A << endl, 0;
}
