#include <bits/stdc++.h>
int N;
int mod = std::pow(10, 9) + 7;
int main() {
  std::cin >> N;
  std::vector<long long> A(N + 1);
  for (int i = 1; i <= N; i++) {
    std::cin >> A[i];
  }
  long long result = 0;
  for (int i = 1; i < N; i++) {
    for (int j = i + 1; j <= N; j++) {
      result += A[i] ^ A[j];
      result = (result >= mod) ? result % mod : result;
    }
  }
  std::cout << result << std::endl;
  return 0;
}
