wlist = [] hlist = [] for i in range(n): a, b = [ int(v) for v in input().split() ] if a not in wlist: wlist.append(a) if b not in hlist: hlist.append(b) lw = len(wlist) lh = len(hlist) print(lw*h+lh*(w-lw)-n)