#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (min(a, b) > 0) {
    if (a < b) swap(a, b);
    a %= b;
  }
  return max(a, b);
}
long long dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
long long dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 10;
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  long long ans = 0;
  for (long long i = 0; i < (n - 1); i++)
    for (long long j = (i + 1); j <= (n - 1); j++) {
      ans += a[i] ^ a[j];
      ans %= MOD;
    }
  cout << ans << endl;
  return 0;
}
