#include <bits/stdc++.h>
int main() {
  int N;
  long A[300001];
  long result = 0;
  std ::cin >> N;
  for (int i = 1; i <= N; i++) {
    std::cin >> A[i];
  }
  for (int i = 1; i <= N - 1; i++) {
    for (int j = i + 1; j <= N; j++) {
      result += (A[i] ^ A[j]);
    }
  }
  result = result % (1000000000 + 7);
  std ::cout << result;
  return 0;
}
