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