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