#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (int)n; ++i) cin >> a[i];
  ll res = 0;
  ll p = 1;
  for (int i = 0; i < (int)61; ++i) {
    ll cnt = 0;
    for (int j = 0; j < (int)n; ++j)
      if (a[j] & (1LL << i)) cnt++;
    cnt *= (n - cnt);
    res += (p * cnt) % MOD;
    res %= MOD;
    p *= 2;
    p %= MOD;
  }
  cout << res << endl;
  return 0;
}
