import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline LIM=5*10**6+1 isp=[False]*LIM isp[2]=True for p in range(3,LIM,2):isp[p]=True for p in range(3,LIM,2): if p*p>=LIM:continue if not isp[p]: continue for j in range(p*p,LIM,p+p):isp[j]=False N,*A=map(int,read().split()) full=0 for x in A: full |= 1<R:break se|=s i+=1 if se==full and ans