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).

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Greedy algorithms


Solutions:
(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)


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))


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)


(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))


(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)


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) = map(int, input().split())
used = [1] * 2 * n
for i in range(m):
	(x, y) = 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 os
import sys
from io import BytesIO, IOBase
import heapq as h
import bisect
from types import GeneratorType
BUFSIZE = 8192

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import collections as col
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7
mod = 10 ** 9 + 7
t = 1
p = 10 ** 9 + 7

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def z_array(s1):
	n = len(s1)
	z = [0] * n
	(l, r, k) = (0, 0, 0)
	for i in range(1, n):
		if i > r:
			(l, r) = (i, i)
			while r < n and s1[r - l] == s1[r]:
				r += 1
			z[i] = r - l
			r -= 1
		else:
			k = i - l
			if z[k] < r - i + 1:
				z[i] = z[k]
			else:
				l = i
				while r < n and s1[r - l] == s1[r]:
					r += 1
				z[i] = r - l
				r -= 1
	return z

def solve():
	ans = 0
	i = 2
	while i <= n - i + 1:
		if i == n - i + 1:
			if dr.get(i, -1) == -1 or dc.get(i, -1) == -1:
				ans += 1
				dr[i] = 1
				dc[i] = 1
		else:
			if dr.get(i, -1) == -1:
				ans += 1
			if dr.get(n - i + 1, -1) == -1:
				ans += 1
			if dc.get(i, -1) == -1:
				ans += 1
			if dc.get(n - i + 1, -1) == -1:
				ans += 1
			dr[i] = 1
			dc[i] = 1
			dr[n - i + 1] = 1
			dc[n - i + 1] = 1
		i += 1
	return ans
for _ in range(t):
	(n, m) = map(int, input().split())
	d = {}
	dr = {}
	dc = {}
	for i in range(m):
		(x, y) = map(int, input().split())
		dr[x] = 1
		dc[y] = 1
	print(solve())


(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) = tuple(map(int, input().split(' ')))
vb = set()
hb = set()
for k in range(m):
	(i, j) = tuple(map(int, input().split(' ')))
	hb.add(i - 1)
	vb.add(j - 1)
c = 0
for i in range(1, n // 2):
	c += 1 if i not in hb else 0
	c += 1 if n - i - 1 not in hb else 0
	c += 1 if i not in vb else 0
	c += 1 if n - i - 1 not in vb else 0
c += 1 if n % 2 == 1 and (n // 2 not in hb or n // 2 not in vb) else 0
print(c)


import sys
(n, m) = 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) = 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)


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def main():
	(n, m) = map(int, input().split())
	rows = [0 for i in range(n)]
	cols = [0 for i in range(n)]
	for i in range(m):
		(x, y) = map(int, input().split())
		rows[x - 1] = 1
		cols[y - 1] = 1
	ans = 0
	for i in range(1, n - 1):
		if not rows[i]:
			ans += 1
			if n % 2 and i == n // 2:
				cols[i] = 1
	for i in range(1, n - 1):
		if not cols[i]:
			ans += 1
	print(ans)
	return
main()


(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):
	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)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(n, m) = value()
row_blocked = defaultdict(bool)
col_blocked = defaultdict(bool)
for i in range(m):
	(x, y) = value()
	row_blocked[x] = True
	col_blocked[y] = True
ans = 0
for i in range(2, n):
	if not row_blocked[i]:
		ans += 1
	if not col_blocked[i]:
		ans += 1
if n % 2:
	if not row_blocked[n // 2 + 1] and (not col_blocked[n // 2 + 1]):
		ans -= 1
print(ans)


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)