#include <stdio.h>
int main(void){
    int n,sum,num,i;
    for(;sum=0,scanf("%d",&n),n;){
        for(i=0;scanf("%d",&num),sum+=num,i!=n-1;i++);
        printf("%d\n",sum%2==0?0:1);
    }
    return 0;
}