N=int(input()) A=list(map(int,input().split())) DP=[[0]*2048 for j in range(N+1)] DP[0][1]=1 for i in range(N): for j in range(2048): if DP[i][j]==0: continue x=j*A[i] if x>=2048: x&=1023 x+=1024 if x>=1024: DP[i+1][x]+=DP[i][j] else: DP[i+1][x]=1 DP[i+1][j&A[i]]=1 print(sum(DP[i+1]))