#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
int main() {
  int n;
  scanf("%d", &n);
  vector<ll> a(n);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  ll ans = 0;
  for (int digit = 0; digit <= 60; digit++) {
    int c0 = 0, c1 = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] & (1LL << digit))
        c1++;
      else
        c0++;
    }
    (ans += (c0 * c1) % MOD * (1LL << digit) % MOD) %= MOD;
  }
  printf("%lld\n", ans);
}
