#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll a[100000];
ll dom[100001];
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  ll a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll ans = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      ans += (a[i] ^ a[j]);
      ans %= 1000000007;
    }
  }
  cout << ans;
  return 0;
}
