#include <bits/stdc++.h>
using namespace std;
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr long long MOD = 1000000007;
using Graph = vector<vector<long long>>;
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  long long A[N];
  for (long long i = 0; i < (long long)(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++) {
      long long x = A[i] ^ A[j];
      ans = (ans + x) % MOD;
    }
  }
  cout << ans << endl;
}
