#include <bits/stdc++.h>
using namespace std;
int main(void) {
  const long long mod = (long long)1e9 + 7;
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long ans = 0;
  for (int d = 0; d < 60; d++) {
    long long tmp = 1LL << d;
    long long zero = 0, one = 0;
    for (int i = 0; i < N; i++) {
      if (A[i] & tmp)
        one++;
      else
        zero++;
    }
    ans += tmp * one % mod * zero % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
