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