#include<iostream>
using namespace std;

int main(){
    int n, m, k, boje = 0, tren = 2;
    cin >> n >> m >> k;
    int x, y;
    int tabela[n][m];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            tabela[i][j] = 0;
        }
    }
    for(int i = 0; i < k; i++){
        cin >> x >> y;
        tabela[x - 1][y - 1] = 1;
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(tabela[i][j] == 0){
                if(i != 0 && tabela[i - 1][j] != 1 && tabela[i - 1][j] != 0){
                tabela[i][j] = tabela[i - 1][j];
                }
             else if(i != n - 1 && tabela[i + 1][j] != 1 && tabela[i + 1][j] != 0){
                 tabela[i][j] = tabela[i + 1][j];
              }
              else if(j != 0 && tabela[i][j - 1] != 1 && tabela[i][j - 1] != 0){
                tabela[i][j] = tabela[i][j - 1];
              }
              else if(j != m - 1 && tabela[i][j + 1] != 1 && tabela[i][j + 1] != 0){
                  tabela[i][j] = tabela[i][j + 1];
               }
              else{
                  tabela[i][j] = tren;
                  if(i != n - 1 && tabela[i + 1][j] == 0)tabela[i + 1][j] = tren;
                  if(j != m - 1 && tabela[i][j + 1] == 0)tabela[i][j + 1] = tren;
                  if(i != 0 && tabela[i - 1][j] == 0)tabela[i - 1][j] = tren;
                  if(j != 0 && tabela[i][j - 1] == 0)tabela[i][j - 1] = tren;
                  tren++;
                  boje++;
               }
            }
        }
    }
    cout << boje;
    return 0;
}