uses crt;
var b,c,i,k,n:integer;

function prost(a:integer):boolean;
  var i:integer;
     z:boolean;
begin
z:=true;
for i:=2 to trunc(sqrt(a)) do
if (a mod i)=0 then z:=false;
prost:=z;

end;

begin
{repeat}
clrscr;
writeln('vvedite n');
readln(n);
k:=0;
b:=2;
for i:=3 to n do
if prost(i) then
  begin
  c:=i;
  if  b+2=c then
  k:=k+1;
  write('(',b,',',c,')   ');
  b:=c;
  end;

writeln;
writeln('answer= ',k);
readln;
{writeln('repeat? (n)');
until readkey ='n'; }
end.