#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 3e5 + 7;
long long a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  long long sum = 0;
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      sum += (a[i] ^ a[j]);
      sum %= mod;
    }
  }
  cout << sum << endl;
  return 0;
}
