#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
template <class T>
inline void chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
}
template <class T>
inline void chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(10);
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (int(i) = 0; (i) < (N); (i)++) cin >> A[i];
  long long answer = 0;
  for (int i = 0; i < N; i++) {
    for (int l = i; l < N; l++) {
      long long tmp = A[i] ^ A[l];
      tmp %= mod;
      answer += tmp;
    }
  }
  answer %= mod;
  cout << answer << "\n";
}
