#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  int N;
  scanf("%d", &N);
  vector<long long> A(N, 0);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A.at(i));
  }
  long long ans = 0LL;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += (long long)(A.at(i) ^ A.at(j));
      ans %= MOD;
    }
  }
  printf("%lld", ans);
  return 0;
}
