#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long j = 0; j <= 60; j++) {
    long long pw = pow(2ll, j);
    long long cnt = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] & pw) cnt++;
    }
    ans += cnt * (n - cnt) % mod * pw % mod;
    ans %= mod;
  }
  cout << ans << "\n";
}
