#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) cin >> A[i];
  vector<long long> N2(61);
  N2[0] = 2;
  for (int i = 1; i < 61; i++) N2[i] = N2[i - 1] * 2;
  vector<long long> numN2(61);
  for (long long i = 0; i < N; i++) {
    for (int j = 0; j < 61; j++) {
      if ((A[i] % N2[j] / (N2[j] / 2)) == 1) numN2[j]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < 61; i++) {
    if (numN2[i] * (N - numN2[i]) == 0) continue;
    long long tmp = numN2[i] * (N - numN2[i]);
    tmp %= 1000000007;
    ans += N2[i] / 2 * tmp;
    ans %= 1000000007;
  }
  cout << fixed;
  cout << setprecision(12) << ans << endl;
}
