#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007;
int main(void) {
  int n;
  scanf("%d\n", &n);
  vector<ll> a(n);
  for (int i = (0); i < ((0) + (n)); ++i) scanf("%d ", &a[i]);
  ll ans = 0;
  vector<ll> ones(65, 0);
  ll tmp = 1;
  for (int i = (0); i < ((0) + (62)); ++i) {
    for (int j = (0); j < (n); ++j) {
      if (((a[j] >> i) & 1LL) == 1) ones[i]++;
    }
    ones[i] = ones[i] * ((ll)n - ones[i]) % MOD;
    ones[i] *= tmp;
    ones[i] %= MOD;
    ans += ones[i];
    ans %= MOD;
    tmp *= 2;
    tmp %= MOD;
  }
  cout << ans << endl;
  return 0;
}
