n = int(input())
zen=[]
ab=[]
ba=[]
for i in range(n):
    a,b=map(int, input().split())
    zen.append([a,b])
    ab.append(a/b)
    ba.append(b/a)

ba=sorted(ba)
from bisect import bisect_left, bisect_right
from collections import defaultdict
kosudic=defaultdict(int)
for i in range(n):
    a,b=zen[i][0],zen[i][1]
    x=-a/b
    #print(x)
    l=bisect_left(ba, x)
    r=bisect_right(ba, x)
    #print(l,r)
    search=ba[l:r]
    kosu=sum([1 for j in search if abs(j-x)<10**(-10)])
    kosudic[kosu]+=1

ans=1
maxs=max(kosudic.keys())
#print(kosudic)

for i in range(maxs,-1,-1):
    if kosudic[i]!=0 and i!=1:
        ans*=(i**2+1)**kosudic[i]
        kosudic[1]-=i
    if i==1:
        ans*=3**(kosudic[1]//2)
    if i==0:
        ans*=2**kosudic[0]

print(ans-1)