#include <bits/stdc++.h>
using namespace std;
using vl = vector<long long>;
using vvl = vector<vl>;
constexpr int MOD = 1000000007;
using long long = long long;
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
void print(const std::vector<int> &v) {
  std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
  std::cout << std::endl;
}
long long modpow(long long a, long long pair<long long, long long>) {
  if (pair<long long, long long> == 0) return 1;
  if (pair<long long, long long> % 2 == 0) {
    long long halfp = pair<long long, long long> / 2;
    long long half = modpow(a, halfp);
    return half * half % MOD;
  } else {
    return a * modpow(a, pair<long long, long long> - 1) % MOD;
  }
}
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < (long long)N; i++) {
    cin >> A[i];
  };
  long long ans = 0LL;
  for (long long i = 0; i < (long long)N; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += A[i] ^ A[j];
      ans %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}
