#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
signed main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  long long ans = 0;
  for (long long j = 0; j < 60; j++) {
    long long cnt = 0;
    for (long long i = 0; i < n; i++) cnt += v[i] & 1, v[i] >>= 1;
    ans += cnt * (n - cnt) % MOD * (1LL << j) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
}
