w=int(input()) h=int(input()) n=int(input()) array=[[0 for i in range(h+10)] for j in range(w+10)] sum=0 for j in range(n): a,b=[int(i) for i in input().split()] if array[a][b]==1: sum-=1 array[a][b]=-1 for i in range(1,h+1): if array[a][i]==0: sum+=1 if array[a][i]!=-1: array[a][i]=1 for i in range(1,w+1): if array[i][b]==0: sum+=1 if array[i][b]!=-1: array[i][b]=1 print(sum)