#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200100;
const long long MOD = 1e9 + 7;
int n;
long long arr[MAXN], ans;
long long dig[100];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &arr[i]);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= 61; j++) dig[j] += (bool)(arr[i] & (1ll << j));
  }
  for (int i = 0; i <= 61; i++)
    ans = (ans + (((dig[i] * (n - dig[i])) % MOD) * ((1ll << i) % MOD)) % MOD) %
          MOD;
  printf("%lld\n", ans);
  return 0;
}
