#include #include #include #include #include using namespace std; int main(){ long long h,w,n;cin>>h>>w>>n; map M; map V; set Ms; set Vs; vector > A(n); for(int i = 0; n > i; i++){ long long a,b;cin>>a>>b; M[a]++; V[b]++; Ms.insert(a); Vs.insert(b); A[i].first = a; A[i].second = b; } long long ans = 0; for(auto x: M){ ans += w-x.second; } for(auto x: V){ ans += h-x.second; } for(auto x: Ms){ for(auto y: Vs){ bool t = true; for(int i = 0; n > i; i++){ if(x == A[i].first && y == A[i].second){ t = false; break; } } ans -= t; } } cout << ans << endl; }