#include <bits/stdc++.h>
using namespace std;
long long lis[300005];
int main(void) {
  int n;
  scanf("%d\n", &n);
  long long mod = 1000000007;
  for (int i = 1; i <= n; i++) scanf("%lld", &lis[i]);
  long long ans = 0;
  long long odd, even;
  for (long long i = 0; i < 60; i++) {
    odd = even = 0;
    for (int j = 1; j <= n; j++) {
      if (lis[j] & 1LL << i)
        odd++;
      else
        even++;
    }
    ans = (ans + odd * even * ((1LL << i) % mod)) % mod;
  }
  printf("%lld\n", (long long)(ans % mod));
  return 0;
}
