{$apptype console}
{$o-,r+,q+}
uses
  SysUtils, Math;

type
  int = longint;
  real = extended;

var
  n: int;
  i: int;
  answer: int;

begin
	assign(input, 'c.in');
  reset(input);
  
  assign(output, 'c.out');
  rewrite(output);
  readln(n);
  if n = 1 then
  begin
    writeln(0);
    halt(0);
  end;
  answer := 1;
  i := 2;
  while i * i <= n do
  begin
    if n mod i = 0 then
    begin
      while n mod i = 0 do
      begin
        n := n div i;
        answer := answer * i;
      end;
      answer := answer * (i - 1) div i;
    end;
    inc(i);
  end;
  if n > 1 then
    answer := answer * (n - 1);
  writeln(answer);
end.
