#include <bits/stdc++.h>
using namespace std;
int N;
long long A[300005];
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) scanf("%lld", &A[i]);
  long long ans = 0;
  for (int z = 0; z < 60; ++z) {
    long long t = 0;
    for (int i = 0; i < N; ++i) t += (A[i] & (1ll << z)) > 0;
    t = (t * (N - t)) % 1000000007;
    ans = (ans + t * (1ll << z)) % 1000000007;
  }
  printf("%lld\n", ans);
}
