#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int B = 60;
const int mod = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<int> cnt(B);
  for (int i = 0; i < N; i++) {
    ll x;
    cin >> x;
    for (ll b = 0; b < B; b++) {
      if (x & (1LL << b)) ++cnt[b];
    }
  }
  ll res = 0;
  for (ll i = 0; i < B; i++) {
    res += (1LL * cnt[i] * (N - cnt[i])) << i;
  }
  cout << res % mod << endl;
  return 0;
}
