#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using ll = long long;
using ld = long double;
const ll LL_MAX = LLONG_MAX;
template <typename T>
T in() {
  T x;
  cin >> x;
  return x;
}
template <typename T, typename U>
void forin(T* x, U n) {
  for (U i = 0; i < n; i++) cin >> x[i];
}
template <typename T>
int div1(T x) {
  return x % 1000000007;
}
template <typename T>
void out(T x) {
  cout << x << endl;
}
int digit(int n) {
  int ans = 0;
  while (n > 0) {
    ans += n % 10;
    n /= 10;
  }
  return ans;
}
int main() {
  int n = in<int>(), a[n], ans = 0;
  forin(a, n);
  for (int i = 0; i < n - 1; i++) {
    for (int i2 = i + 1; i2 < n; i2++) {
      ans += div1((a[i] ^ a[i2]));
      ans = div1(ans);
    }
  }
  out(ans);
}
