#include <bits/stdc++.h>
using namespace std;
const long long p = 1e9 + 7;
template <class t>
inline void read(t &s) {
  s = 0;
  register long long f = 1;
  register char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) s = (s << 3) + (s << 1) + (c ^ 48), c = getchar();
  s *= f;
  return;
}
long long cnt[64];
signed main(void) {
  long long n;
  register long long x;
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    read(x);
    for (long long k = 0; k < 61; ++k)
      if (x & (1ll << k)) ++cnt[k];
  }
  register long long ans = 0;
  for (long long k = 0; k < 61; ++k)
    ans += cnt[k] * (n - cnt[k]) % p * (1ll << k) % p, ans %= p;
  cout << ans << endl;
  return 0;
}
