#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define PI acos(-1.0) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) typedef long long ll; typedef pair P; ll s[100], k[100]; map MAP; map MAPr; map MAPl; int main(){ ll h, w, n; cin >> w >> h >> n; int cntr = 0, cntl = 0; FOR(i,0,n){ cin >> s[i] >> k[i]; MAP[P(s[i], k[i])] = true; MAP[P(k[i], s[i])] = true; MAPr[s[i]]++; MAPl[k[i]]++; } cntr = MAPr.size(); cntl = MAPl.size(); ll ans = h * cntr - n + w * cntl - n; ll hiku = 0; FOR(i,0,n){ FOR(j,0,n){ if(i==j) continue; if(MAP.count(P(s[i], k[j])) == 0) hiku++; } } cout << ans - hiku << endl; return 0; }