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()) xst.add((X - 1) + (Y - 1)) yst.add((X - 1) - (Y - 1)) lis = [[] for _ in [0] * 2] for x in sorted(xst): lis[x & 1].append(x) ans = 0 for x in xst: ans += min(x, n - 1) - max(-n + 1 + x, 0) + 1 for y in yst: b = abs(y) & 1 ans += min(n - 1 + y, n - 1) - max(y, 0) + 1 l = bisect_left(lis[b], max(y, -y)) r = bisect_right(lis[b], min(2 * (n - 1) - y, 2 * (n - 1) + y)) ans -= r - l print(ans)