#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long res = 0;
  for (long long bit = 0; bit < 60; bit++) {
    long long one = 0;
    for (long long i = 0; i < N; i++) {
      one += (A[i] >> bit) & 1;
    }
    long long tmp = one * (N - one) % MOD;
    (tmp *= (1LL << bit)) %= MOD;
    res += tmp;
    res %= MOD;
  }
  cout << res % MOD << endl;
  return 0;
}
