#include <bits/stdc++.h>
using namespace std;
template <class t>
inline t read(t &x) {
  x = 0;
  char c = getchar();
  bool f = 0;
  while (!isdigit(c)) f |= c == '-', c = getchar();
  while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  if (f) x = -x;
  return x;
}
template <class t>
inline void write(t x) {
  if (x < 0) {
    putchar('-'), write(-x);
  } else {
    if (x > 9) write(x / 10);
    putchar('0' + x % 10);
  }
}
const long long mod = 1e9 + 7;
long long ans[90], tot, cnt[90], n;
signed main() {
  read(n);
  for (long long i = 1, x; i <= n; i++) {
    read(x);
    for (long long j = 0; j < 61; j++)
      if (x >> j & 1ll) cnt[j]++;
  }
  for (long long i = 0, p = 0; i < 80; i++) {
    ans[i] = cnt[i] * (n - cnt[i]) + p;
    p = ans[i] >> 1;
    p %= mod;
    ans[i] &= 1;
  }
  for (long long i = 0, p = 1; i < 80; i++, (p *= 2) %= mod)
    if (ans[i]) (tot += p) %= mod;
  write(tot);
}
