#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int main() {
  ll N;
  scanf("%lld", &N);
  ll A[N + 10];
  for (ll i = 0; i < N; ++i) scanf("%lld", &A[i]);
  ll res = 0;
  for (ll bits = 0; bits < 60; ++bits) {
    ll num0 = 0, num1 = 0;
    for (int i = 0; i < N; ++i)
      if (A[i] & (1LL << bits))
        ++num1;
      else
        ++num0;
    ll tmp = num0 % mod * num1 % mod << bits % mod;
    res += tmp;
    res %= mod;
  }
  printf("%lld\n", res);
  return 0;
}
