#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long ans = 0;
  long long MOD = 1e9 + 7;
  long long base = 1;
  for (int i = 0; i < 80; i++) {
    long long zero = 0;
    long long one = 0;
    for (int n = 0; n < N; n++) {
      if (A[n] % 2 == 0) zero++;
      if (A[n] % 2 == 1) one++;
      A[n] /= 2;
    }
    long long add = (base * zero) % MOD;
    add = (add * one) % MOD;
    ans = (ans + add) % MOD;
    base *= 2;
  }
  cout << ans << endl;
}
