#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> cnt(N);
  for (int i = 0; i < (n); i++) {
    ll x;
    cin >> x;
    v.push_back(bitset<N>(x));
    for (int j = 0; j < (N); j++) {
      if (v[i][j]) cnt[j]++;
    }
  }
  ll ans = 0;
  for (int i = 0; i < (n - 1); i++) {
    for (int j = 0; j < (N); j++) {
      if (v[i][j]) cnt[j]--;
    }
    bitset<N> bs(v[i]);
    ll tmp = 0;
    for (int j = 0; j < (N); j++) {
      if (bs[j])
        tmp = mod(tmp + modm(1LL << j, n - i - 1 - cnt[j]));
      else
        tmp = mod(tmp + modm(1LL << j, cnt[j]));
    }
    ans = mod(ans + tmp);
  }
  cout << ans << endl;
  return 0;
}
