#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<int> A(61);
  for (int i = 0; i < N; i++) {
    long long a;
    cin >> a;
    for (int j = 0; j < 61; j++) {
      if (a & 1) A[i]++;
      a /= 2;
    }
  }
  long long ans = 0;
  long long exp = 1;
  for (int i = 0; i < 61; i++) {
    ans = (ans + (((A[i] * (N - A[i])) % MOD) * exp) % MOD) % MOD;
    exp = (exp * 2) % MOD;
  }
  cout << ans << endl;
}
