#include <bits/stdc++.h>
using namespace std;
long long func(int p) {
  long long a = 1;
  if (p == 0) return 1;
  for (int i = 1; i <= p; i++)
    a = ((a % 1000000007) * (2 % 1000000007)) % 1000000007;
  return a;
}
int main() {
  long long i, j, n;
  long long xr;
  long long ara[30001];
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%lld", &ara[i]);
  for (i = 0, xr = 0; i < 60; i++) {
    long long zc = 0, ac = 0;
    long long isum = 0;
    for (j = 0; j < n; j++) {
      if (ara[j] % 2 == 0)
        zc++;
      else
        ac++;
      ara[j] = ara[j] / 2;
    }
    isum = ((zc % 1000000007) * (ac % 1000000007)) % 1000000007;
    isum = ((isum % 1000000007) * (func(i) % 1000000007)) % 1000000007;
    xr = ((xr % 1000000007) + (isum % 1000000007)) % 1000000007;
  }
  printf("%lld\n", xr);
  return 0;
}
