#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx")
using namespace std;
const long long mod = 1e9 + 7;
const long long oo = 1e9 + 10;
const int Max = 1e6 + 10;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
  if (ci - cn == cm) {
    fread_unlocked(cn, 1, cm, stdin);
    ci = cn;
  }
  return *ci++;
}
inline long long getint() {
  long long A = 0;
  if (ci - cn + 24 > cm)
    while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
  else
    while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
  return A;
}
void solve() {
  long long n, t;
  cin >> n;
  long long a[60] = {0};
  int mx = 0;
  for (int i = 0; i < n; i++) {
    t = getint();
    int cnt = 0;
    while (t) {
      if (t & 1) a[cnt]++;
      t >>= 1;
      cnt++;
    }
    mx = max(mx, cnt);
  }
  long long ans = 0;
  for (long long i = 0; i < mx; i++) {
    ans += (1LL << i) % mod * (a[i] * (n - a[i]) % mod);
    ans %= mod;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  solve();
  return 0;
}
