#include <bits/stdc++.h>
long long n;
long long a;
long long eo[110], ez[110];
long long maxx;
long long sum;
long long to = 1;
void ee(long long x) {
  int ff = 1;
  while (x > 0) {
    eo[ff] += x % 2;
    eo[ff] %= 1000000007;
    x /= 2;
    ff++;
  }
  if (ff > maxx) maxx = ff;
}
int main(void) {
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a);
    ee(a);
  }
  maxx--;
  for (int i = 1; i <= 100; i++) {
    ez[i] = n - eo[i];
    ez[i] %= 1000000007;
  }
  for (int i = 1; i <= 100; i++) {
    sum += (ez[i] * eo[i] * to) % 1000000007;
    sum %= 1000000007;
    to *= 2;
    to %= 1000000007;
  }
  printf("%lld", sum);
  return 0;
}
