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