#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) cin >> A[i];
  vector<long long> cnt(61, 0);
  for (long long i = 0; i < 61; i++) {
    for (long long j = 0; j < N; j++) {
      cnt[i] += ((A[j] & (1ll << i)) > 0);
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 61; i++) {
    long long a = cnt[i], b = N - cnt[i];
    ans = (ans + ((a * b % mod) * (1LL << i) % mod)) % mod;
  }
  cout << ans << endl;
  return 0;
}
