#include <bits/stdc++.h>
using namespace std;
std::ostream& co_() { return std::cout << std::endl; }
std::istream& cn_() { return std::cin; }
template <class Head, class... Args>
std::ostream& co_(Head&& head, Args&&... args) {
  std::cout << head;
  return co_(std::forward<Args>(args)...);
}
template <class Head, class... Args>
std::istream& cn_(Head&& head, Args&&... args) {
  std::cin >> head;
  return cn_(std::forward<Args>(args)...);
}
const long long mod = 1000000007;
long long inv(long long p) {
  long long a = p, b = mod, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    std::swap(a, b);
    u -= t * v;
    std::swap(u, v);
  }
  u %= mod;
  if (u < 0) u += mod;
  return u;
}
int main() {
  int n;
  cn_(n);
  vector<long long> d(n);
  long long sum = 0;
  for (long long(i) = 0; (i) < (n); ++(i)) {
    cn_(d[i]);
    for (long long(j) = 0; (j) < (i); ++(j)) {
      sum = (sum + (d[j] ^ d[i]) % mod) % mod;
    }
  }
  co_(sum);
  ;
}
