#include //const static double de_PI = 3.14159265358979323846; //const static int de_MOD = 1000000007; //const static int de_MAX = 999999999; //const static int de_MIN = -999999999; int main(void) { //std::ifstream in("123.txt"); std::cin.rdbuf(in.rdbuf()); int W = 0, H = 0, N = 0, S = 0, K = 0, ans = 0; std::cin >> W >> H >> N; std::vector mark(W, true), number(H, true); for (int i = 0; i < N; i++) { std::cin >> S >> K; if (mark[S - 1]) { ans += std::count(number.begin(), number.end(), true) - 1; mark[S - 1] = false; } else { ans--; } if (number[K - 1]) { ans += std::count(mark.begin(), mark.end(), true); number[K - 1] = false; } } std::cout << ans << std::endl; }