#include <bits/stdc++.h>
#define MAXN 300005
#define MOD 1000000007
using namespace std;

typedef long long LL;
int N;
LL A[MAXN];

int main () {
  scanf("%d",&N);
  for (int i=0;i<N;++i) scanf("%lld",&A[i]);
  LL ans = 0;
  for (int z=0;z<60;++z) {
    LL t = 0;
    for (int i=0;i<N;++i) t += (A[i]&(1ll<<z)) > 0;
    t = (t * (N - t)) % MOD;
    LL v = (1ll<<z) % MOD;
    ans = (ans + t * v) % MOD;
  }
  printf("%lld\n",ans);
}
