#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  long long ans = 0;
  long long tmp2 = 1;
  long long tmp3 = 1;
  for (long long i = 0; i < 61; i++) {
    long long cnt0 = 0;
    long long cnt1 = 0;
    for (int j = 0; j < N; j++) {
      if (A.at(j) & tmp3)
        cnt1++;
      else
        cnt0++;
    }
    long long tmp = cnt0 * cnt1;
    tmp *= tmp2;
    tmp %= MOD;
    ans += tmp;
    ans %= MOD;
    tmp2 = (tmp2 * 2) % MOD;
    tmp3 *= 2;
  }
  cout << ans << endl;
  return 0;
}
