#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
int main() {
  int n;
  cin >> n;
  long long A[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  int sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += (A[i] ^ A[j]) % 1000000007;
      sum %= 1000000007;
    }
  }
  cout << sum << endl;
  return 0;
}
