{$r+,q+,o-}
{$apptype console}
type
	int = longint;

procedure gen(n: int);
var
	i, j: int;

begin
	for i := 1 to n do begin
		for j := 1 to i - 1 do begin
			if ((i + j) mod 4 <= 1) then
				writeln(i, ' ', j);
		end;
	end;
end;

var
	n, k, i: int;

begin
	reset(input, 'selfdual.in');
	rewrite(output, 'selfdual.out');

	read(n);

	k := n div 4;
	if (n mod 4 = 0) then begin
		writeln('YES');
		writeln(k * (4 * k - 1));
		gen(n);
		for i := 1 to n - 1 do begin
			write(i + 1, ' ');
		end;
		writeln('1');
	end else if (n mod 4 = 1) then begin
		writeln('YES');
		writeln(k * (4 * k - 1) + 2 * k);
		gen(n - 1);
		for i := 1 to 2 * k do begin
			writeln(n, ' ', 2 * i - 1);
		end;
		for i := 1 to n - 2 do begin
			write(i + 1, ' ');
		end;
		writeln('1 ', n);
	end else begin
		writeln('NO');
	end;
end.
