#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10, mod = 1e9 + 7;
long long a[N];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    int numzero = 0, numone = 0;
    for (int j = 1; j <= n; j++) {
      if ((1LL << i) & (1LL * a[j]))
        numone++;
      else
        numzero++;
    }
    ans = (ans % mod + 1LL * numzero * numone * (1LL << i) % mod) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
