n=int(input())
a=[]
for i in range(n):
  line=input().split(" ")
  a.append(line)
g=0
for i in range(n):
  for j in range(n):
      ai=int(a[i][0])
      bi=int(a[i][1])
      aj=int(a[j][0])
      bj=int(a[j][1])
      ki=(ai*aj)+(bi*bj)
      if ki==0:
        g=g+1

ans=2**(n-g)*3**(g/2)-1
print(int(ans))