#include <bits/stdc++.h>
using namespace std;
long long n, a[1000005], ans;
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (long long i = 0; i <= 61; i++) {
    long long say = 0;
    for (long long j = 1; j <= n; j++)
      if (a[j] & (1ll << i)) say++;
    long long kac = n * (n - 1) / 2ll;
    kac -= say * (say - 1) / 2ll;
    kac -= (n - say) * (n - say - 1) / 2ll;
    ans = (ans + ((1ll << i) % 1000000007) * kac % 1000000007) % 1000000007;
  }
  printf("%lld\n", ans);
  return 0;
}
