#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
const int mod = 1e9 + 7;
int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * f;
}
long long arr[MAXN];
int main() {
  long long sum = 0;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i <= n - 1; i++) {
    for (int j = i + 1; j <= n; j++) {
      sum = (sum + (arr[i] ^ arr[j])) % mod;
    }
  }
  cout << sum << endl;
  return 0;
}
