#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long ans;
void solve(long long N, std::vector<long long> A) {
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += (A[i] ^ A[j]);
      ans = ans % MOD;
    }
  }
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  cout << ans << endl;
  return 0;
}
