#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<uint64_t> A(60, 0);
  for (int n = 0; n < N; ++n) {
    uint64_t a;
    cin >> a;
    for (int idx = 0; a; ++idx, a /= 2) {
      if (a % 2) ++A[idx];
    }
  }
  uint64_t sum = 0;
  for (int idx = 0; idx < 60; ++idx) {
    sum += A[idx] * (N - A[idx]) << idx;
    if (sum > 1000000007) sum %= 1000000007;
  }
  cout << sum << endl;
  return 0;
}
