#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mpow(ll x, ll n) {
  ll ans = 1;
  while (n != 0) {
    if (n & 1) ans = ans * x % 1000000007;
    x = x * x % 1000000007;
    n = n >> 1;
  }
  return ans;
}
signed main() {
  ll N, A, B;
  cin >> N;
  ll maxL = 60;
  vector<vector<ll>> accum(maxL, vector<ll>(2));
  vector<bitset<60>> input(N);
  for (ll i = 0; i < (ll)(N); i++) {
    ll x;
    cin >> x;
    bitset<60> bs = x;
    input[i] = bs;
  };
  for (ll i = 0; i < N; i++) {
    for (ll j = 0; j < maxL; j++) {
      if (input[i][j] == 0) {
        accum[j][0]++;
      } else {
        accum[j][1]++;
      }
    }
  }
  ll res = 0;
  for (ll i = 0; i < N; i++) {
    for (ll j = 0; j < maxL; j++) {
      if (input[i][j] == 0) {
        res += mpow(2, j) * accum[j][1];
        res %= 1000000007;
      } else {
        res += mpow(2, j) * accum[j][0];
        res %= 1000000007;
      }
    }
  }
  cout << res / 2 << "\n";
}
