#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long f = 1, s = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 1) + (s << 3) + ch - '0', ch = getchar();
  return s * f;
}
long long a, b[400000], c;
int mod = 1e9 + 7;
int main() {
  a = read();
  for (int i = 1; i <= a; i++) {
    b[i] = read();
    for (int j = 1; j <= i; j++) {
      c += b[i] xor b[j];
    }
  };
  cout << (long long)c % mod;
}
