#include <bits/stdc++.h>
using namespace std;
const int md = 1e9 + 7;
const int mxn = 3e5;
long long a[mxn + 11];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", a + i);
  }
  long long cur = 1;
  long long ans = 0;
  for (int i = 1; i <= 61; i++) {
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & cur) cnt++;
    }
    long long now = cnt * 1LL * (n - cnt) % md;
    now = now * 1LL * cur % md;
    ans = (ans + now) % md;
    cur <<= 1;
  }
  printf("%lld\n", ans);
  return 0;
}
