#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long a[100];
int main() {
  int n;
  scanf("%I64d", &n);
  for (int i = 1; i <= n; i++) {
    long long s, u = 0;
    scanf("%I64d", &s);
    while (s) {
      a[u++] += s % 2;
      s /= 2;
    }
  }
  long long cou = 0, s = 1;
  for (int i = 0; i <= 60; i++) {
    cou = (cou + s % mod * a[i] % mod * (n - a[i]) % mod) % mod;
    s *= 2;
  }
  printf("%I64d\n", cou);
}
