#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
inline long long int read() {
  long long int x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
  return x;
}
map<int, int> exist;
const long long int mod = 1e9 + 7;
int solve(int xmkosaw);
int main() {
  int n = read();
  long long int arr[n];
  for (long long int(i) = (0); i < (long long int)(n); i++) arr[i] = read();
  long long int sum = 0;
  for (long long int(i) = (0); i < (long long int)(n); i++)
    for (long long int(j) = (i + 1); j < (long long int)(n); j++) {
      sum += (arr[i] ^ arr[j]) % mod;
    }
  sum = sum % mod;
  cout << sum << endl;
}
