#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};
ll D = 61;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  ll n;
  cin >> n;
  ll abit[n][D];
  for (ll i = 0; i < n; i++) {
    ll a;
    cin >> a;
    for (ll j = 0; j < D; j++) {
      abit[i][j] = ll(a % 2);
      a /= 2;
    }
  }
  ll cnt[n][D];
  for (ll j = 0; j < D; j++) {
    cnt[n - 1][j] = abit[n - 1][j];
  }
  for (ll i = n - 2; i >= 0; i--) {
    for (ll j = 0; j < D; j++) {
      cnt[i][j] = cnt[i + 1][j] + abit[i][j];
    }
  }
  ll sum = 0;
  for (ll i = 0; i < n - 1; i++) {
    ll b = 1;
    for (ll j = 0; j < D; j++) {
      if (abit[i][j] == 0) {
        sum = (sum + (b * cnt[i + 1][j]) % MOD) % MOD;
      } else {
        sum = (sum + (b * ((n - i - 1) - cnt[i + 1][j])) % MOD) % MOD;
      }
      b = (b * 2) % MOD;
    }
  }
  cout << sum << endl;
}
