#include <bits/stdc++.h>
int bit_counts[61];
int main(void) {
  int n, i, j;
  long long int a, res = 0;
  scanf("%d\n", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &a);
    for (j = 0; a; j++, a >>= 1) {
      bit_counts[j] += a & 1;
    }
  }
  for (i = 60; i >= 0; i--) {
    res = res * 2 % 1000000007LL +
          bit_counts[i] * (n - bit_counts[i]) % 1000000007LL;
    res %= 1000000007LL;
  }
  printf("%lld\n", res);
}
