#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  long long int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  int freq[61];
  memset(freq, 0, sizeof(int) * 61);
  for (int i = 0; i < n; i++) {
    for (int j = 60; j >= 0; j--) {
      if (a[i] >= (long long int)pow(2.0, (double)(j))) {
        freq[j]++;
        a[i] = a[i] - (long long int)pow(2.0, (double)j);
      }
    }
  }
  long long int sum = 0;
  for (int i = 0; i < 61; i++) {
    sum =
        (sum + (freq[i] * (n - freq[i])) * (long long int)pow(2.0, (double)i)) %
        (1000000007LL);
  }
  printf("%lld\n", sum);
  return 0;
}
