#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long t = 0;
  register char v = getchar();
  while (v < '0' || v > '9') v = getchar();
  while (v >= '0' && v <= '9') {
    t = (t << 3) + (t << 1) + (v ^ 48);
    v = getchar();
  }
  return t;
}
const long long M = 1e9 + 7;
inline long long ksm(register long long p, register long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans *= p;
      ans %= M;
    }
    p *= p;
    p %= M;
    b >>= 1;
  }
  return ans;
}
long long cnt[62];
long long ans, n;
int main() {
  n = read();
  for (register long long i = 1; i <= n; ++i) {
    long long num = 0;
    long long tmp = read();
    while (num <= 61) {
      if (tmp & 1)
        ++cnt[num], ans = (ans + ksm(2, num) * (i - cnt[num])) % M;
      else
        ans = (ans + (1 << num) * cnt[num]) % M;
      tmp >>= 1;
      ++num;
    }
  }
  printf("%lld", ans);
}
