#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  long a[n], ans = 0;
  int cnt1[60] = {0};
  for (int i = 0; i < n; i++) {
    scanf("%ld", a + i);
    for (int j = 0; j < 60; j++)
      if ((a[i] & (1ull << j)) != 0) cnt1[j]++;
  }
  for (int i = 0; i < 60; i++) {
    ans += (((cnt1[i] * (n - cnt1[i])) % 1000000007) *
            ((1ull << i) % 1000000007)) %
           1000000007;
    ans %= 1000000007;
  }
  printf("%ld\n", ans);
  return 0;
}
