import math
N = int(input())
BOX = {}

I00 = 0
I10 = 0
I01 = 0
for i in range(N):
    A, B = input().split()
    A, B = int(A), int(B)
    A, B = A//math.gcd(A,B), B//math.gcd(A,B)

    if A == 0 and B == 0:
        I00 += 1
    elif A == 0:
        I01 += 1
    elif B == 0:
        I10 += 1
    else:
        M1, M2 = "-", "+"
        if A*B > 0:
            M1, M2 = "+", "-"
        A, B = abs(A), abs(B)

        C1 = M1+str(A)+'/'+str(B)
        C2 = M2+str(B)+'/'+str(A)

        if C1 not in BOX:
            BOX[C1] = [1, 0]
        else:
            BOX[C1][0] += 1

        if C2 not in BOX:
            BOX[C2] = [0, 1]
        else:
            BOX[C2][1] += 1

def comb1(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ANS = [0]
def comb(n):
    if len(ANS) > n:
        return ANS[n]
    c = len(ANS)
    while len(ANS) <= n:
        r = 0;
        for i in range(c):
            if i > 0:
                r += comb1(c, i)
        ANS.append(r+1)
        c += 1
    return ANS[n]

res = 1;
for k, v in BOX.items():
    if k[0] == '+':
        if v[0] == 0 or v[1] == 0:
            res *= (comb(v[0] + v[1]) + 1)
        else:
            res *= (1 + comb(v[0]) + comb(v[1]))

reigai = 1
if I01 > 0:
    reigai += comb(I01)
if I10 > 0:
    reigai += comb(I10)
print(res*reigai - 1 + I00)
