#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1000000007;
ll modPow(ll a, ll n) {
  if (n == 0) return 1;
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  ll t = modPow(a, n / 2);
  return (t * t) % MOD;
}
ll modComb(ll n, ll a) {
  ll x = 1, y = 1;
  for (long long i = 0; i < (a); ++i) {
    x *= n - i;
    x %= MOD;
    y *= i + 1;
    y %= MOD;
  }
  y = modPow(y, MOD - 2);
  return (x * y) % MOD;
}
int main() {
  ll N, ans = 0;
  cin >> N;
  vector<ll> A(N);
  vector<P> B(60, P(0, 0));
  for (long long i = 0; i < (N); ++i) {
    cin >> A.at(i);
    for (long long j = 0; j < (60); ++j) {
      if (A.at(i) % (ll)pow(2, j + 1) > A.at(i) % (ll)pow(2, j)) {
        B.at(j).first++;
      } else {
        B.at(j).second++;
      }
    }
  }
  for (long long j = 0; j < (60); ++j) {
    ans += ((B.at(j).first * B.at(j).second) % MOD) * modPow(2, j);
    ans %= MOD;
  }
  cout << ans << endl;
}
