from math import gcd
n = int(input())
bad = {}
for i in range(n):
    a,b = map(int, input().split())
    if a != 0 and b != 0:
        g = gcd(a, b)
        a //= g
        b //= g

    is_minus = True
    if a>0 and b>0 : is_minus = False
    if a<0 and b<0 : is_minus = False
    sign_ab = -1 if is_minus else 1
    sign_cd = 1 if is_minus else -1
    d, c = a, b = abs(a), abs(b)
    key1 = (sign_ab*a, b)
    key2 = (sign_cd*c, d)

    # print(f'{key1}  {key2}')

    if key1 in bad: bad[key1][0] += 1
    elif key2 in bad: bad[key2][1] += 1
    else: bad[key1] = [1,0]

# print(n)
# print(bad)
# for a,b in bad:
#     print(f'({a:2}, {b:2}) {bad[a,b]}')

zero = 0
cnt = 1
for a,b in bad:
    # print('a b',a,b)
    if a==0 and b==0:
        pass
        # print('zero',a,b)
        c1, c2 = bad[a, b]
        zero += c1 + c2
    else:
        pass
        # print('none zero',a,b)
        c1, c2 = bad[a, b]
        # print('c1,c2:',c1,c2)
        c3 = (2**c1 - 1) + (2**c2 - 1) + 1
        # print('c3:',c3)
        cnt *= c3

ans = cnt
ans += zero
ans -= 1
# print('cnt',cnt)
# print('zero',zero)
# print('ans',ans)
print(ans)
