#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long N;
  cin >> N;
  vector<long long> vec(N);
  const long long mod = 1000000000 + 7;
  int64_t ans = 0;
  for (long long i = 0; i < N; ++i) cin >> vec[i];
  for (long long i = 0; i < N - 1; ++i) {
    long long a = vec[i];
    for (long long j = i + 1; j < N; ++j) ans += a ^ vec[j];
  }
  cout << ans % mod << endl;
  return 0;
}
