Pagini recente » Cod sursa (job #1545070) | Cod sursa (job #3139686) | Cod sursa (job #2434802) | Cod sursa (job #2536099) | Cod sursa (job #2460456)
var a,b,c,d,n,i,p,count,count2,last:longint;
este:boolean;
var x:array[1..2000010] of boolean;
fin,fout:textfile;
begin
assign(fin,'ciur.in');
reset(fin);
assign(fout,'ciur.out');
rewrite(fout);
readln(fin,n);
p:=2;
i:=2;
x[1]:=True;
x[2]:=False;
while este=false do begin
if last=p then este:=true;
while i<=n do begin
i:=i+p;
if i<> n then begin
x[i]:=True;
end;
end;
for i:=p to n do begin
if (i>p) and (x[i]=False) then begin
last:=p;
p:=i;
break;
end;
end;
i:=p;
end;
{for i:=1 to n do
if n mod i=0 then
inc(a);
if a=2 then x[n]:=false
else x[n]:=true;}
for i:=1 to n do
if x[i]=false then inc(b);
writeln(fout,b);
close(fin);
close(fout);
end.