N=int(input())

a_list=[]
b_list=[]
for i in range(N) :
  a,b=map(int,input().split())

  a_list.append(-a/b)
  b_list.append(b/a)

import collections
c=collections.Counter(a_list)
d=collections.Counter(b_list)
e=list(c.keys())
f=list(c.values())
g=list(d.keys())
h=list(d.values())
count=0
for i in range(len(e)) :
  for j in range((len(g))):
    if e[i]==g[j]:
      count+=f[i]*h[j]*2**(N-2)
count=count/2
print(count)
print(2**N-1-count)