import math def f(a,b,p,c,d,q): if a*d-b*c==0: return p*c==q*a else: x=(p*d-b*q)/(a*d-b*c) y=(a*q-p*c)/(a*d-b*c) if math.isclose(x,round(x)) and math.isclose(y,round(y)): return True else: return False a,b,c,d=tuple(map(int,input().split())) n=int(input()) live=[] for i in range(n): live.append(list(map(int,input().split()))) group=[] for i in live: notingroup=True for j in group: k=j[0] if f(a,c,k[0]-i[0],b,d,k[1]-i[1]): j.append(i) notingroup=False break if notingroup: group.append([i]) print(len(group))