#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll MOD = 1000000007;
void solve(void) {
  int N;
  cin >> N;
  vector<ll> A(N);
  vector<vector<bool>> bitA(N, vector<bool>(61, 0));
  for (int i = 0; i < (N); i++) {
    cin >> A[i];
    for (ll j = 60; j >= 0; j--) {
      ll s = 1LL << j;
      bitA[i][j] = A[i] / s;
      A[i] = A[i] % s;
    }
  }
  ll sum = 0;
  for (int i = 0; i < (N - 1); i++) {
    for (int j = i + 1; j < N; j++) {
      ll tmp = 0;
      for (int k = 0; k < (61); k++) {
        if (bitA[i][k] != bitA[j][k]) {
          tmp += pow(2, k);
        }
      }
      sum += tmp;
      sum = sum % MOD;
    }
  }
  cout << sum << endl;
  return;
}
int main(int argc, const char* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
