mod = 998244353 def main(): import sys from bisect import bisect_left input = sys.stdin.readline N, M = map(int, input().split()) U0 = set() U1 = set() V0 = set() V1 = set() ans = 0 for _ in range(M): x, y = map(int, input().split()) u = x + y v = x - y if u & 1: U1.add(u) else: U0.add(u) if v & 1: V1.add(v) else: V0.add(v) ans += N - abs(N + 1 - u) ans += N - abs(v) ans -= 1 U0 = sorted(list(U0)) U1 = sorted(list(U1)) V0 = sorted(list(V0)) V1 = sorted(list(V1)) for u in U0: mi = max(2 - u, -2 * N + u) ma = min(2 * N - u, -2 + u) ans -= bisect_left(V0, ma + 1) - bisect_left(V0, mi) for u in U1: mi = max(2 - u, -2 * N + u) ma = min(2 * N - u, -2 + u) ans -= bisect_left(V1, ma + 1) - bisect_left(V1, mi) print(ans) if __name__ == '__main__': main()