#include <bits/stdc++.h>
using ll = int64_t;
using namespace std;
constexpr ll MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> p(n);
  for (int i = 0; i < (n); ++i) cin >> p[i];
  ll ans = 0;
  for (int i = 0; i < (60); ++i) {
    int cnt = 0;
    for (int j = 0; j < (n); ++j) {
      if (p[j] >> i & 1) cnt++;
    }
    int a = cnt * (n - cnt);
    for (int j = 0; j < (i); ++j) a = a * 2 % MOD;
    ans += a;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
