#include <bits/stdc++.h>
void reverse(long long n, char *s) {
  long long i, j;
  char tmp;
  for (i = 0, j = n - 1; i < j; i++, j--) tmp = s[i], s[i] = s[j], s[j] = tmp;
}
void insert(long long n, char *s) {
  long long i, j;
  for (i = n - 1, j = 60LL - 1; i >= 0; i--, j--) s[j] = s[i];
  for (i = 0; i < 60LL - n; i++) s[i] = '0';
}
int main() {
  static char bb[300000LL][60LL + 1];
  long long n, i, j, k, ans;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    long long a;
    scanf("%lld", &a);
    k = 0;
    while (a > 0) {
      bb[i][k++] = a % 2 + '0';
      a /= 2;
    }
    reverse(k, bb[i]);
    insert(k, bb[i]);
    printf("%s\n", bb[i]);
  }
  ans = 0;
  for (j = 0; j < 60; j++) {
    k = 0;
    for (i = 0; i < n; i++)
      if (bb[i][j] == '0') k++;
    ans = (ans + k * (n - k) * (1LL << 59 - j)) % 1000000007LL;
  }
  printf("%lld\n", ans);
  return 0;
}
