Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every minute moves each chip into an adjacent cell. He moves each chip from its original edge to the opposite edge. Gerald loses in this game in each of the three cases:  At least one of the chips at least once fell to the banned cell.  At least once two chips were on the same cell.  At least once two chips swapped in a minute (for example, if you stand two chips on two opposite border cells of a row with even length, this situation happens in the middle of the row). 

In that case he loses and earns 0 points. When nothing like that happened, he wins and earns the number of points equal to the number of chips he managed to put on the board. Help Gerald earn the most points.


-----Input-----

The first line contains two space-separated integers n and m (2 ≤ n ≤ 1000, 0 ≤ m ≤ 10^5) — the size of the field and the number of banned cells. Next m lines each contain two space-separated integers. Specifically, the i-th of these lines contains numbers x_{i} and y_{i} (1 ≤ x_{i}, y_{i} ≤ n) — the coordinates of the i-th banned cell. All given cells are distinct.

Consider the field rows numbered from top to bottom from 1 to n, and the columns — from left to right from 1 to n.


-----Output-----

Print a single integer — the maximum points Gerald can earn in this game.


-----Examples-----
Input
3 1
2 2

Output
0

Input
3 0

Output
1

Input
4 3
3 1
3 2
3 3

Output
1



-----Note-----

In the first test the answer equals zero as we can't put chips into the corner cells.

In the second sample we can place one chip into either cell (1, 2), or cell (3, 2), or cell (2, 1), or cell (2, 3). We cannot place two chips.

In the third sample we can only place one chip into either cell (2, 1), or cell (2, 4).

Difficulty: competition

Starter code:

Solutions:
n, m = list(map(int, input().split()))
used = [1] * 2 * n
for i in range(m):
	x, y = list(map(int, input().split()))
	used[x - 1] = used[n + y - 1] = 0
	
if n % 2 and used[n // 2]:
	used[n // 2 + n] = 0
res = sum(used)
for i in [0, n - 1, n, 2 * n - 1]:
	res -= used[i]
print(res)



import sys
n,m=list(map(int,input().split()))

Rowsr=[True]*(n)
Rowsr[0]=False
Rowsr[-1]=False
Rowsl=[True]*n
Rowsl[0]=False
Rowsl[-1]=False
Colu=[True]*(n)
Colu[0]=False
Colu[-1]=False
Cold=[True]*(n)
Cold[0]=False
Cold[-1]=False
for i in range(m):
    a,b=list(map(int,sys.stdin.readline().split()))
    Rowsr[a-1]=False
    Colu[b-1]=False
    Rowsl[a-1]=False
    Cold[b-1]=False
ans=0

for i in range(n//2):
    x=[Rowsr[i],Rowsr[n-1-i],Colu[i],Colu[n-1-i]]
    ans+=x.count(True)

if(n%2==1):
    if(Rowsr[n//2] or Colu[n//2]):
        ans+=1
print(ans)


n, m = list(map(int, input().split()))
l = [0 for i in range(0, n)]
c = [0 for i in range(0, n)]
sol = 0

for i in range(0, m):
    a, b = list(map(int, input().split()))
    l[a-1] = 1
    c[b-1] = 1

for i in range(1, n//2):
    #ma ocup de liniile i si n-i, coloanele la fel
    sol += 4 - (l[i] + c[i] + l[n-i-1] + c[n-i-1])

if n % 2 == 1:
    if not l[n//2] or not c[n//2]: sol += 1

print(sol)
    
    


I=input
n,m=map(int,I().split())
l=set([1,n])
t=set([1,n])
for i in range(m):
    a,b=map(int,I().split())
    l.add(a)
    t.add(b)
total=n-len(t)+n-len(l)
m=n/2+0.5
if n%2 and (m not in l) and (m not in t): total-=1
print(total)

I=input
n,m=map(int,I().split())
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=map(int,I().split())
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))

n, m = map(int, input().split())
k = n + 1
a, b = [0] * k, [0] * k
a[0] = a[1] = a[n] = b[0] = b[1] = b[n] = 1
for i in range(m):
    x, y = map(int, input().split())
    a[x] = b[y] = 1
s = a.count(0) + b.count(0)
if n & 1 and 0 == a[k // 2] == b[k // 2]: s -= 1
print(s)

n, m = map(int, input().split())
k = n + 1
a, b = [False] * k, [False] * k
for i in range(m):
    x, y = map(int, input().split())
    a[x] = True
    b[y] = True
s = a[2: n].count(False) + b[2: n].count(False)
if n & 1 and not (a[k // 2] or b[k // 2]): s -= 1
print(s)

instr = input()
tmplist = instr.split()
n = (int)(tmplist[0])


lx = [n for i in range(n)]
ly = [n for i in range(n)]

m = (int)(tmplist[1])
for i in range(m):
    instr = input()
    tmplist = instr.split()
    x = (int)(tmplist[0])
    y = (int)(tmplist[1])
    lx[x-1] -= 1
    ly[y-1] -= 1

ans = 0
for i in range(1,n-1):
    if lx[i] == n:
        ans += 1
    if ly[i] == n:
        ans += 1


if n % 2 == 1:
    if lx[(n//2)] == n and ly[(n//2)] == n:
        ans -= 1

print (ans)


n, m = list(map(int, input().split()))
set_x = {1, n}
set_y = {1, n}
set_total = {x for x in range(1, n + 1)}

for i in range(0, m):
    x, y = list(map(int, input().split()))
    set_x.add(x)
    set_y.add(y)

result = 0
avai_x = set_total - set_x
avai_y = set_total - set_y
result = len(avai_x) + len(avai_y)
if (n & 1) == 1 and ((n >> 1) + 1) in avai_y and ((n >> 1) + 1) in avai_x:
    result -= 1

print(result)





def solve():
    n, m = map(int, input().split())
    a = [0 for x in range(n)]
    b = [0 for x in range(n)]
    for i in range(m):
        row, col = map(int, input().split())
        row -= 1
        col -= 1
        a[row] += 1
        b[col] += 1
    res = 0
    for i in range(1, n - 1):
        if a[i] == 0: res+=1
        if b[i] == 0: res+=1
        if a[i] == 0 and b[i] == 0 and i == n - i - 1: res-=1
    print(res)
solve()

n,m=list(map(int,input().split()))
a=[1]*(n*2)
a[0]=a[n-1]=a[n]=a[n*2-1]=0
for i in range(m):
    x,y=list(map(int,(input().split())))
    a[x-1]=a[y+n-1]=0
if(n%2 and a[n+n//2] and a[n//2]):a[n//2]=0
print(sum(a))


# Not Original Submission, Unable to solve the problem
I=input
n,m=map(int,I().split())
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=map(int,I().split())
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))

I=input
n,m=map(int,I().split())
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=map(int,I().split())
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))

n, m = map(int, input().split())
ans = 0
row = [1] * n * 2
for x in range(m):
	a, b = [int(x) for x in input().split()]
	row[a - 1] = 0
	row[b - 1 + n] = 0

for i in range(1, (n + 1) // 2):
	j = n - 1 - i
	if i == j:
		ans += min(1, row[i] + row[i + n])
	else:
		ans += row[i] + row[j] + row[i + n] + row[j + n]
print (ans)

I=input
n,m=list(map(int,I().split()))
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=list(map(int,I().split()))
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))


I=input
n,m=list(map(int,I().split()))
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=list(map(int,I().split()))
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))


I=input
n,m=list(map(int,I().split()))
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=list(map(int,I().split()))
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))


I=input
n,m=list(map(int,I().split()))
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=list(map(int,I().split()))
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))


I=input
n,m=list(map(int,I().split()))
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=list(map(int,I().split()))
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))


I=input
n,m=list(map(int,I().split()))
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=list(map(int,I().split()))
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))


I=input
n,m=list(map(int,I().split()))
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=list(map(int,I().split()))
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))


I=input
n,m=list(map(int,I().split()))
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=list(map(int,I().split()))
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))


I=input
n,m=map(int,I().split())
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=map(int,I().split())
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))

n, m = map(int, input().split())
ans = 0
row = [1] * n * 2
for x in range(m):
	a, b = [int(x) for x in input().split()]
	row[a - 1] = 0
	row[b - 1 + n] = 0

for i in range(1, (n + 1) // 2):
	j = n - 1 - i
	if i == j:
		ans += min(1, row[i] + row[i + n])
	else:
		ans += row[i] + row[j] + row[i + n] + row[j + n]
print (ans)

I=input
n,m=list(map(int,I().split()))
b=[1]*n*2
b[0]=b[n-1]=b[n]=b[2*n-1]=0
for i in range(m):
    r,c=list(map(int,I().split()))
    b[r-1]=b[n+c-1]=0
if n%2 and b[n//2] and b[n+n//2]:b[n//2]=0
print(sum(b))



# Made By Mostafa_Khaled