import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int W = scanner.nextInt(); int H = scanner.nextInt(); int N = scanner.nextInt(); boolean[][] hands = new boolean[W + 1][H + 1]; boolean[][] covered = new boolean[W + 1][H + 1]; for (int i = 0; i < N; i++) { int S = scanner.nextInt(); int K = scanner.nextInt(); hands[S][K] = true; covered[S][K] = true; } long match = 0; for (int i = 1; i <= W; i++) { boolean found = false; for (int j = 1; j <= H; j++) { if (hands[i][j]) { found = true; for (int k = 1; k <= W; k++) { if (!covered[k][j]) { covered[k][j] = true; match++; } } } } if (!found) continue; for (int k = 1; k <= H; k++) { if (!covered[i][k]) { covered[i][k] = true; match++; } } } System.out.println(match); } }