input() n=input()[:-1].replace(" ","") ans=0 for i in range(len(n)): a = n[i:] f=0 for j in a: if j != str(f%2): ans += 1 else: break f+=1 print(ans)