#include <bits/stdc++.h>
using namespace std;
int N;
long long A[300005];
long long sum;
int main() {
  scanf("%d\n", &N);
  for (int i = 0; i < N; i++) scanf("%lld", &A[i]);
  for (int k = 0; k <= 60; k++) {
    int nZero = 0, nOne = 0;
    for (int i = 0; i < N; i++) {
      if (A[i] & ((long long)1 << k))
        nOne++;
      else
        nZero++;
    }
    sum += nZero * nOne * (((long long)1 << k) % 1000000007);
    sum %= 1000000007;
  }
  printf("%lld\n", sum);
  return 0;
}
