from collections import Counter,defaultdict
import sys
input = sys.stdin.readline

n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
mod = 1000000007

adivb = [-float('inf') if ab[i][1] == 0 else ab[i][0] / ab[i][1]
         for i in range(n)]
bdiva = [-float('inf') if ab[i][0] == 0 else -ab[i][1] / ab[i][0]
         for i in range(n)]

adb, bda = Counter(adivb), Counter(bdiva)
cntadb, cnt = defaultdict(int), 0
for i in adb:
    if (i in bda) and (i >= 0):
        cntadb[i] += bda[i] + adb[i] +1
        cnt += bda[i] + adb[i]
ans = 1
for i in cntadb:
    ans *= cntadb[i]
print(ans*2**(n-cnt)-1)
