N = int(input())

oN = 0
No = 0
AB = []
ABlen = 0
Bad = []
d = {}

for i in range(N):
  A,B = map(int, input().split())
  if A == 0 and B == 0:
    continue
  elif A == 0:
    oN += 1
  elif B == 0:
    No += 1
  else:
    AB.append([A,B])
    ABlen += 1  
    if -B/A in d.values():
      for k, v in d.items():
        if -B/A == v:
          Bad.append([k+1,i+1])
  
    d[i] = A/B


C = 2**(ABlen-len(Bad))


ans = C + C*(2**oN-1) + C*(2**No-1)
print(ans)