#coding:utf-8 N=input() X=map(int,raw_input().split()) X.sort() s=[X[0]] for i in range(1,N): if X[i]-s[i-1]==2: s.append(X[i]) else: s.append(0) if N%2==0: if X==s: print N else: print 0 else: print 1