from bisect import bisect_left, bisect_right import sys input = sys.stdin.readline n, m = map(int, input().split()) xst = set([]); yst = set([]) for _ in [0] * m: X, Y = map(int, input().split()) X -= 1; Y -= 1 xst.add(X + Y) yst.add(X - Y) xlis = [[] for _ in [0] * 2] ylis = [[] for _ in [0] * 2] for x in sorted(xst): b = abs(x) & 1 xlis[b].append(x) for y in sorted(yst): b = abs(y) & 1 ylis[b].append(y) num = dc = 0 for x in xst: b = abs(x) & 1 num += min(x, n - 1) - max(-n + 1 + x, 0) + 1 l = bisect_left(ylis[b], max(-x, x - 2 * (n - 1))) r = bisect_right(ylis[b], min(2 * (n - 1) - x, x)) dc += r - l for y in yst: b = abs(y) & 1 num += min(n - 1 + y, n - 1) - max(y, 0) + 1 l = bisect_left(xlis[b], max(y, -y)) r = bisect_right(xlis[b], min(2 * (n - 1) - y, 2 * (n - 1) + y)) dc += r - l ans = num - dc // 2 print(ans)