#include <bits/stdc++.h>
const int MAXN = 3e5 + 7;
const long long HA = 1e9 + 7;
int n;
long long a[MAXN], ans;
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) scanf("%lld", a + i);
  for (int tt = (0); tt <= (60); ++tt) {
    long long bast = (1ll << tt);
    long long c[2] = {0, 0};
    for (int i = (1); i <= (n); ++i) {
      ans = (ans + bast * c[!((a[i] >> tt) & 1)] % HA) % HA;
      c[(a[i] >> tt) & 1]++;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
