#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int MAXN = 3e5 + 10;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
int cnt[100];
signed main() {
  int n;
  long long res = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    for (int j = 0; j <= 61; j++) cnt[j] += x & (1LL << j) ? 1 : 0;
  }
  for (int i = 0; i <= 61; i++)
    res = (res + (((cnt[i] % MOD * ((n - cnt[i]) % MOD)) % MOD) *
                  ((1LL << i) % MOD)) %
                     MOD) %
          MOD;
  printf("%lld\n", res % MOD);
  return 0;
}
