#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (auto &ai : a) cin >> ai;
  long long ans = 0;
  for (int k = 0; k < 60; k++) {
    vector<long long> cnt(2);
    for (auto &ai : a) {
      (ans += cnt[((ai) >> (k)&1) ^ 1] << k) %= MOD;
      cnt[((ai) >> (k)&1)]++;
    }
  }
  cout << ans << endl;
  return 0;
}
