#include <bits/stdc++.h>
using namespace std;
int main() {
  const int MOD = 1e9 + 7;
  int N;
  cin >> N;
  vector<long long> A(N);
  for (auto &a : A) {
    cin >> a;
  }
  long long ans = 0;
  for (int place = 0; place <= 60; place++) {
    long long count[2] = {0, 0};
    for (int i = 0; i < N; i++) {
      count[(A[i] >> place) & 1]++;
    }
    ans += (count[0] * count[1]) << place;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
