i,ip=int,input son, n, w = i(ip())+i(ip()), i(ip()), 0 book = sorted([ip() for _ in range(n)]) for i in book: a = book.count(i) if a != 1: w += a - 1 for _ in range(a-1):book.remove(i) print(w*son)