#41833: python AC 解


deansuo1825@gmail.com (黃昱碩)

學校 : 不指定學校
編號 : 256775
來源 : []
最後登入時間 :
2023-11-25 09:56:15

a,b=map(int,input().split())
n=int(input())
total=0
for i in range(n):
  counter=[int(x) for x in input().split()]
  if counter.count(a)-counter.count(-a)>0 and counter.count(b)-counter.count(-b)>0:
    total+=1
print(total)