#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll N;
  cin >> N;
  ll A[N];
  ll ans = 0;
  ll od = 1000000007;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A, A + N);
  ll ma = A[N - 1];
  ll cnt = 0;
  while (0 == 0) {
    if (pow((ll)(2), cnt + 1) > ma) {
      break;
    } else {
      cnt++;
    }
  }
  for (ll bit = 0; bit <= cnt; bit++) {
    ll zero = 0;
    ll one = 0;
    for (ll i = 0; i < N; i++) {
      if (A[i] & (1 << bit)) {
        one++;
      } else {
        zero++;
      }
    }
    ll a = (one * zero);
    ll b = (1 << bit);
    ans += (a * b) % od;
    ans %= od;
  }
  cout << ans << endl;
  return 0;
}
