#include <bits/stdc++.h>
using namespace std;
signed main() {
  int64_t N;
  cin >> N;
  vector<int64_t> A(N);
  for (int64_t i = (int64_t)(0); i < (int64_t)(N); i++) cin >> A[i];
  int64_t ans = 0;
  for (int64_t i = (int64_t)(0); i < (int64_t)(N - 1); i++) {
    for (int64_t j = (int64_t)(i + 1); j < (int64_t)(N); j++) {
      int64_t X = A.at(i) ^ A.at(j);
      ans += X;
      ans %= 1000000007;
    }
  }
  cout << ans << endl;
}
