#include <bits/stdc++.h>
using namespace std;
struct ProconInit {
  static constexpr int IOS_PREC = 15;
  static constexpr bool AUTOFLUSH = false;
  ProconInit() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(IOS_PREC);
    if (AUTOFLUSH) cout << unitbuf;
  }
} PROCON_INIT;
const long long NM = 3 * 100000;
long long A[NM];
long long DIV = 1000000007;
void solve() {
  long long N;
  cin >> N;
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  for (long long i = 0; i < N - 1; i++) {
    for (long long j = i + 1; j < N; j++) {
      ans += ((A[i]) ^ A[j]) % DIV;
    }
  }
  cout << (ans % DIV);
}
int main() {
  solve();
  return 0;
}
