#include <bits/stdc++.h>
using namespace std;
int64_t mod = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64_t n;
  cin >> n;
  vector<int64_t> a(n);
  for (int64_t i = 0; i < n; i++) cin >> a.at(i);
  int ans = 0;
  for (int i = 0; i < 60; i++) {
    int64_t x0 = 0;
    int64_t x1 = 0;
    for (int64_t k = 0; k < n; k++) {
      int64_t x = (a.at(k) >> i) & 1;
      x == 0 ? x0++ : x1++;
    }
    int64_t cnt = x0 * x1 % mod;
    for (int64_t j = 0; j < i; j++) cnt = cnt * 2 % mod;
    ans += cnt;
  }
  cout << ans % mod << endl;
  return 0;
}
