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