program pil_11_64(input,output);

var
  k,i,n,nmb:integer;
  x,y:real;
  c:char;

function nod(x,y:integer):integer;
begin
  while (x<>0)and(y<>0) do
    if x>=y then x := x mod y
    else y := y mod x;
  NOD := x+y;
end;

function fi(n:integer):integer;
var
  count, i : integer;
begin
  count:=1;
  for i:=2 to n-1 do
    if nod(i,n)=1 then count:=count+1;
  fi:=count;
end;

function tau(n:integer):integer;
var
  count, i : integer;
begin
  count:=1;
  for i:=1 to n div 2 do
    if n mod i=0 then count:=count+1;
  tau:=count;
end;

function pi(n:integer):integer;
var
  lim : integer;
  count, i, j : integer;
begin
  count:=0;
  for i:=1 to n do
  begin
    j:=2;
    lim:=round(sqrt(i));
    while (i mod j<>0) and (j<=lim) do j:=j+1;
    if (j>lim) then count:=count+1;
  end;
  pi:=count;
end;

procedure printgraph(state,len:integer);
var
  ypos, i : integer;
begin
  for n:=1 to len do
  begin
    case state of
      1: ypos:=fi(n);
      2: ypos:=tau(n);
      3: ypos:=pi(n);
    end;
    write(n);
    for i:=1 to ypos-1 do write(' ');
    writeln('*');
  end;
end;

procedure wait;
begin
  write('Press <Enter>');
  ReadLn;
end;

begin
  readln(k);
  writeln('fi(n)');
  printgraph(1,k);
  wait;
  writeln('tau(n)');
  printgraph(2,k);
  wait;
  writeln('pi(n)');
  printgraph(3,k);
end.


