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