#include <bits/stdc++.h>
using namespace std;
int64_t MOD = 1000000007;
const long long INF = 1LL << 60;
int main() {
  int64_t N, ans = 0;
  cin >> N;
  vector<int64_t> S(N);
  for (int i = 0; i < (int)(N); i++) cin >> S.at(i);
  for (int64_t i = 0; i < N - 1; i++) {
    for (int64_t j = i + 1; j < N; j++) {
      ans += (S.at(i) ^ S.at(j));
      ans %= MOD;
    }
  }
  cout << ans;
}
