2 5 10
2 2
1 1
1 4
2 1
1 2
1 5
2 4
2 5
1 3
2 3
 2 2 2
1 1
2 2
 3 3 9
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
 7 5 35
5 3
3 5
1 1
2 5
6 4
7 2
5 1
3 4
6 5
7 3
4 1
2 2
4 2
2 4
4 3
3 3
6 1
1 2
4 5
1 3
2 1
5 5
7 5
7 1
6 2
1 4
1 5
3 2
4 4
5 2
2 3
6 3
7 4
5 4
3 1
 1 5 4
1 1
1 2
1 4
1 5
 1 1 1
1 1
 5 7 21
4 4
4 5
5 5
5 6
5 7
5 1
5 2
4 2
3 2
3 1
3 7
3 6
2 6
1 6
1 7
1 1
1 2
1 3
1 4
2 4
3 4
 2 1 1
1 1
 2 2 4
2 1
1 1
1 2
2 2
 3000 3000 1
2222 738
 5 7 35
1 2
2 3
5 1
5 7
4 4
5 3
3 1
2 6
4 5
2 7
4 1
2 1
2 2
1 7
5 6
3 6
4 6
1 6
1 1
3 3
3 4
4 2
2 5
5 5
3 5
2 4
1 5
1 3
4 3
5 4
1 4
3 7
4 7
3 2
5 2
 5 4 1
4 1
 3 4 12
2 3
3 2
2 2
2 1
1 2
3 1
1 4
1 3
3 3
2 4
3 4
1 1
 3 3 3
1 1
2 2
3 3

8
 1
 6
 26
 4
 0
 20
 0
 2
 1
 28
 1
 9
 3


                
s = raw_input().split()

r = int(s[0])
c = int(s[1])
n = int(s[2])

if c == 1:
    print '0'
else:

    sea = set([])

    for i in xrange(r+2):
        for j in xrange(1,c*2+1):
            sea.add((i,j))
    compon = []

    for i in xrange(n):
        s = raw_input().split()
        ri = int(s[0])
        ci = int(s[1])
        ci2 = ci+c
        if (ri,ci) in sea:
            sea.remove((ri,ci))
            sea.remove((ri,ci+c))
            #print "REMOVING 2 CELLS", sea
            
        else:
            #print "CELL ALREADY DELETED"
            continue # cell already deleted
    
        
        foundcompon1 = []
        
        for cell in [(ri-1,ci),(ri-1,ci-1),(ri-1,ci+1),(ri,ci-1),(ri,ci+1),(ri+1,ci),(ri+1,ci-1),(ri+1,ci+1)]:
            if cell not in sea:
                for j in xrange(len(compon)):
                    if cell in compon[j]:
                        foundcompon1.append(j)
                        break

                
        foundcompon2 = []
        
        for cell in [(ri-1,ci+c),(ri-1,ci-1+c),(ri-1,ci+1+c),(ri,ci-1+c),(ri,ci+1+c),(ri+1,ci+c),(ri+1,ci-1+c),(ri+1,ci+1+c)]:
            if cell not in sea:
                for j in xrange(len(compon)):
                    if cell in compon[j]:
                        foundcompon2.append(j)
                        break
        foundcompon1 = list(set(foundcompon1))
        foundcompon2 = list(set(foundcompon2))
        foundcompon1.sort()
        foundcompon2.sort()

        if len(set(foundcompon1).intersection(set(foundcompon2))) > 0:
            sea.add((ri,ci))
            sea.add((ri,ci+c))
            #print "NONEMPTY INTERSECTION:", foundcompon1, foundcompon2
        else:
            if len(foundcompon1)>0:
                #print "EMPTY INTERSECTION:", foundcompon1, foundcompon2
                #print "COMPON NOW:", compon
                compon[foundcompon1[0]].add((ri,ci))
                if len(foundcompon1) > 1:
                    #print "more than 1 compon"
                    for j in foundcompon1:
                        if j == foundcompon1[0]:
                            continue
                        compon[foundcompon1[0]] = compon[foundcompon1[0]].union(compon[j])

            else:
                #print "NO NEIGHBORS FOUND for 1st compon"
                compon.append(set([(ri,ci)]))
                
            if len(foundcompon2)>0:
                #print "EMPTY INTERSECTION:", foundcompon1, foundcompon2
                #print "COMPON NOW:", compon
                compon[foundcompon2[0]].add((ri,ci+c))
                if len(foundcompon2) > 1:
                    #print "more than 1 compon"
                    for j in foundcompon2:
                        if j == foundcompon2[0]:
                            continue
                        compon[foundcompon2[0]] = compon[foundcompon2[0]].union(compon[j])

            else:
                #print "NO NEIGHBORS FOUND for 2nd compon"
                compon.append(set([(ri,ci+c)]))
        



            if len(foundcompon1)>0 or len(foundcompon2)>0:
                foundcompon = foundcompon1[1:] + foundcompon2[1:]
                foundcompon.sort()
                foundcompon.reverse()
                for j in foundcompon:
                    compon.pop(j)
                #print "result:", compon
                    
       
        print "compon:", compon
                
    painted = r*c - (len(sea)//2 - 2*c)
    print painted

