#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
long long n;
signed main() {
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) {
    cin >> a[i];
  }
  long long sum = 0;
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = i + 1; j < n; j++) {
      long long temp = (a[i] ^ a[j]) % 1000000007;
      sum += temp;
      sum %= 1000000007;
    }
  }
  cout << sum << endl;
  return 0;
}
