#include <bits/stdc++.h>
long long n, a, sum, i, j, t;
int l[100], mod = 1000000007, max;
int main() {
  int idx;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &a);
    idx = 0;
    while (a) {
      l[idx] = (l[idx] + (a % 2)) % mod;
      idx++;
      a /= 2;
      if (idx > max) max = idx;
    }
  }
  idx = 1;
  for (i = 0; i < max; i++) {
    t = ((l[i] * (n - l[i])) * idx) % mod;
    sum = (sum + t) % mod;
    idx *= 2;
    idx %= mod;
  }
  printf("%lld", sum);
  return 0;
}
