#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int64_t n;
  cin >> n;
  int64_t a[n];
  const int64_t Mod = 1e9 + 7;
  for (int64_t i = 0; i < n; i++) cin >> a[i];
  int64_t sum = 0;
  for (int64_t bit = 0; bit < 60; bit++) {
    int64_t k = (1ll << bit);
    int ct = 0;
    for (int64_t i = 0; i < n; i++)
      if (a[i] & k) ++ct;
    sum = (sum + (k % Mod) * (ct % Mod) * ((n - ct) % Mod)) % Mod;
  }
  cout << sum % Mod;
}
