#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << (a) << endl;
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << " ";
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << " ";
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << " ";
  pr(b, c, d);
}
int INF = numeric_limits<int>::max();
int main(void) {
  int n;
  cin >> n;
  long long a[n + 10];
  long long MOD = pow(10, 9) + 7;
  for (int i = int(0); i <= int(n - 1); ++i) {
    cin >> a[i];
  }
  long long ans = 0;
  for (int i = int(0); i <= int(n - 2); ++i) {
    for (int j = int(i); j <= int(n - 1); ++j) {
      ans += (a[i] ^ a[j]) % MOD;
    }
  }
  pr(ans % MOD);
  return 0;
}
