#include <bits/stdc++.h>
int main() {
  static long long aa[300000];
  int n, i, j, k;
  long long ans;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%lld", &aa[i]);
  ans = 0;
  for (j = 0; j < 60; j++) {
    k = 0;
    for (i = 0; i < n; i++)
      if (aa[i] & 1LL << j) k++;
    ans = (ans + (((long long)k * (n - k) % 1000000007) << j)) % 1000000007;
  }
  printf("%lld\n", ans);
  return 0;
}
