#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
void run_case() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (auto &x : a) cin >> x;
  long long ans = 0;
  for (int bit = 0; bit < 60; ++bit) {
    int cnt1 = 0, cnt0 = 0;
    for (int i = 0; i < n; ++i) {
      if (((a[i] >> bit) & 1) == 0) {
        (ans += cnt1 * (1LL << bit) % MOD) %= MOD;
        cnt0++;
      } else {
        (ans += cnt0 * (1LL << bit) % MOD) %= MOD;
        cnt1++;
      }
    }
  }
  cout << (ans + MOD) % MOD;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cout.flags(ios::fixed);
  cout.precision(9);
  run_case();
  cout.flush();
  return 0;
}
