#include <bits/stdc++.h>
int main(void) {
  long int n, i, j, temp;
  long int sum = 0;
  int bits[60];
  for (i = 0; i < 60; i++) {
    bits[i] = 0;
  }
  scanf("%ld", &n);
  for (i = 0; i < n; i++) {
    scanf("%ld", &temp);
    for (j = 0; j < 60; j++) {
      bits[j] += temp % 2;
      temp /= 2;
    }
  }
  for (i = 0; i < 60; i++) {
    temp = 1;
    for (j = i; j > 0; j--) {
      temp *= 2;
      temp %= 1000000007;
    }
    temp *= bits[i] * ((n - bits[i]) % 1000000007);
    sum += (temp % 1000000007);
    sum %= 1000000007;
  }
  printf("%ld\n", sum);
  return 0;
}
