#include <stdio.h>
int validate_checksum(int *mem, int n) {
int checksum = 0;
for (int i = 0; i<n-1; i++){
checksum ^= *(mem+i);
}
return *(mem+n-1) == checksum ? 1 : 0;
}
int main() {
int n, arr[100];
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &arr[i]);
}
int result = validate_checksum(arr, n);
printf("%d", result);
return 0;
}