from collections import Counter
from math import gcd
n = int(input())
lst = []
cnt = 0

for i in range(n):
    a,b = map(int,input().split())
    if a == b == 0:
        cnt += 1
    elif b > 0:
        lst.append((a/gcd(a,b),b/gcd(a,b)))
    elif b < 0:
        lst.append((-a/gcd(a,b),-b/gcd(a,b)))
    else:
        lst.append(1,0)

c = Counter(lst)
ans = 1
for k,v in c.items():
    if k[0] <= 0 or k == (1,0):
        continue
    j = c[(-k[1],k[0])]
    ans *= 2**j+2**v-1
    c[k] = 0
    if c[(-k[1],k[0])]:
        c[(-k[1],k[0])] = 0
for k,v in c.items():
    if k[0] == 0 or v == 0:
        continue
    ans *= 2**v
ans *= 2**c[(0,1)]+2**c[(1,0)]-1
print(ans-1)