#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define mid(l, r) ((l)+(r))/2
#define len(a) (a).length()
#define sz(a) (a).size()
#define xx first
#define yy second
#define inf int(2e9)
#define ff(i, a, b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i, a, b) for(int (i) = (a); (i) >= (b); --(i))


using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

template<class T>
void print(const T niz[], const int siz)
{
    for(int i=0;i<siz;i++)
        cout << niz[i] << " ";
    cout << endl;
}

int n, m, k;
int edges;
int square;
int triangle;
pii niz[100005];
vector<int> hor[2];
vector<int> ver[2];
map<pii,int>mark;
bool cmphor(int x, int y){
    return niz[x].yy < niz[y].yy;
}
bool cmpver(int x, int y){
    return niz[x].xx < niz[y].xx;
}
bool checkedge(int x, int y){
    if(x == y)return false;
    if( (abs(niz[x].xx - niz[y].xx) <= 1) && (abs(niz[x].yy - niz[y].yy) <= 1))return 1;
    return 0;
}
bool checkvertex(int x, int y){
    if(x < 1 || x > n)return 0;
    if(y < 1 || y > m)return 0;
    if(mark.find({x,y}) == mark.end())return 0;
    return 1;
}
map<pii,int>ima;
void prodji(vector<int> x){
    int duz = x.size();
    ff(i,0,duz - 2){
        if(checkedge(x[i], x[i + 1]))continue;
        //cout << x[i] << " " << x[i + 1] << endl;
        ima[{x[i], x[i + 1]}] = ima[{x[i + 1], x[i]}] = 1;
        edges++;
    }
}
void obrisi(int x, int y){
    ima.erase({x,y});
    ima.erase({y,x});
}
void napravi(int x, int y){
    if(x == y)return;
    if(x == -1 ||y == -1)return;
    if(ima.find({x,y}) != ima.end())return;
    edges++;
    ima[{x,y}] = ima[{y,x}] = 1;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> m >> k;
    ff(i,0,k - 1){
        int x, y;
        cin >> x >> y;
        niz[i] = {x,y};
        mark[{x,y}] = i;
        if(x == 1)hor[0].pb(i);
        if(x == n)hor[1].pb(i);
        if(y == 1)ver[0].pb(i);
        if(y == m)ver[1].pb(i);
    }
    sort(hor[0].begin(), hor[0].end(), cmphor);
    sort(hor[1].begin(), hor[1].end(), cmphor);
    sort(ver[0].begin(), ver[0].end(), cmpver);
    sort(ver[1].begin(), ver[1].end(), cmpver);
    prodji(hor[0]);
    prodji(hor[1]);
    prodji(ver[0]);
    prodji(ver[1]);
    int p1,p2,p3,p4,p5,p6,p7,p8;
    p1 = p2 = p3 = p4 = p5 = p6 = p7 = p8 = -1;
    if(hor[0].size()){p1 = hor[0][0];p2 = hor[0][hor[0].size() - 1];}
    if(hor[1].size()){p3 = hor[1][0];p4 = hor[1][hor[1].size() - 1];}
    if(ver[1].size()){p5 = ver[1][0];p6 = ver[1][ver[1].size() - 1];}
    if(ver[0].size()){p7 = ver[0][ver[0].size()-1];p8 = hor[0][0];}
    //cout <<
    napravi(p2,p3);
    napravi(p4,p5);
    napravi(p6,p7);
    napravi(p8,p1);
    ff(i,0,k - 1){
        int x = niz[i].xx;
        int y = niz[i].yy;
        ff(dltx,-1,1){
            ff(dlty,-1,1){
                if(checkvertex(x + dltx, y + dlty)){
                    int koji = mark[{x + dltx, y + dlty}];
                    if(koji == i)continue;
                    if(ima.find({i,koji}) != ima.end())continue;
                    //cout << i << " " << koji << endl;
                    edges++;
                    ima[{i,koji}] = ima[{koji,i}] = 1;
                }
            }
        }
    }
    //return 0;
    ff(i,0,k - 1){
        int x = niz[i].xx;
        int y = niz[i].yy;
        if(checkvertex(x + 1, y + 1) && checkvertex(x + 1, y) && checkvertex(x, y + 1)){
            edges -= 2;
            obrisi(i, mark[{x+1,y+1}]);
            obrisi(mark[{x+1,y}], mark[{x,y + 1}]);
            square++;
        }
    }
    ff(i,0,k - 1){
        int x = niz[i].xx;
        int y = niz[i].yy;
        bool a,b,c,d;
        a = checkvertex(x-1,y);
        b = checkvertex(x,y+1);
        c = checkvertex(x+1,y);
        d = checkvertex(x,y-1);
        if(a && b && !checkvertex(x-1,y+1))triangle++;
        if(b && c && !checkvertex(x+1,y+1))triangle++;
        if(c && d && !checkvertex(x+1,y-1))triangle++;
        if(d && a && !checkvertex(x-1,y-1))triangle++;
    }
    //cout << edges <<  " " << triangle << " " << square << endl;
    int dlt = 1;
    if(p1 == -1 || p3 == -1 || p5 == -1 || p7 == -1)dlt = 0;
    cout << 2 + edges - k - triangle - square - dlt;
    return 0;
}