#include <bits/stdc++.h>
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
using namespace std;
void solve() {
  long long mod = 1000000007;
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long even = 0;
    long long odd = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] >> i & 1 == 1)
        odd++;
      else
        even++;
    }
    ans += even * odd * pow(2, i);
    ans %= mod;
  }
  cout << ans % mod << endl;
}
signed main() { solve(); }
