#include <fstream>

using namespace std;

int N, K;
int Nd1[2002], Nd2[2002];
bool is[1002][1002];

int main()
{
	ifstream fin("broscute.in");
	ofstream fout("broscute.out");
	
	fin >> N >> K;
	for (int i = 1, pos1, pos2; i <= K; ++i)
	{
		fin >> pos1 >> pos2;
		is[pos1][pos2] = true;
		
		++Nd1[pos1 + pos2 - 1];
		++Nd2[pos1 - pos2 + N];
	}
	
	int result = 0;
	for (int i = 1; i <= N; ++i)
		for (int j = 1; j <= N; ++j)
		{
			if (is[i][j]) result += ((Nd1[i + j - 1] + Nd2[i - j + N] - 2) > 0);
			else          result += (Nd1[i + j - 1] > 0 && Nd2[i - j + N] > 0);
		}
	
	fout << result;
	
	fin.close();
	fout.close();
}
