#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
constexpr int MOD = 1000000007;
int mod(const ll &x) { return x > 0 ? x % MOD : (x + MOD) % MOD; }
int modm(const ll &x, const ll &m) { return x * m % MOD; }
int modpow(ll x, ll p) {
  int ret = 1;
  while (p > 0) {
    if (p & 1) ret = modm(ret, x);
    x = modm(x, x);
    p >>= 1;
  }
  return ret;
}
int modd(ll x, ll d) { return modm(x, modpow(d, MOD - 2)); }
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  constexpr int N = 62;
  int n;
  cin >> n;
  vector<bitset<N>> v;
  vector<int> c1(N), c0(N);
  for (int i = 0; i < (n); i++) {
    ll x;
    cin >> x;
    bitset<N> bs(x);
    for (int j = 0; j < (N); j++) {
      if (bs[j])
        c1[j]++;
      else
        c0[j]++;
    }
  }
  int ans = 0;
  for (int i = 0; i < (N); i++) {
    ans = mod(ans + mod(modm(modm(c1[i], c0[i]), 1LL << i)));
  }
  cout << ans << endl;
  return 0;
}
