N = int(input())
st = {}
dz = 0
for i in range(N):
    a, b = map(int,input().split())
    if a == 0 and b == 0:
        dz += 1
    elif b == 0:
        if 'inf' in st:
            st['inf'] += 1
        else:
            st['inf'] = 1
    else:
        c = a / b
        if c in st:
            st[c] += 1
        else:
            st[c] = 1
ans = 1
if 'inf' in st and 0 in st:
    ans *= (2**(st['inf']+2**(st[0])-1))
    del st['inf']
    del st[0]
alr = set()
for i in st:
    if i in alr:
        pass
    else:
        g = -1/i
        if g in st:
            ans *= (2**(st[i])+2**(st[g])-1)
            alr |= {g,i}
for i in alr:
    del st[i]
for key, value in st.items():
    ans *= 2**value
print(ans-1+dz)