import scala.io.StdIn.{readLine, readInt}

object Main {

  def factorize(p:Int,d:Int,l:Set[Int]):Set[Int] = {
    if(d >= Math.sqrt(p)+1) {
      if(p != 1) l+p else l
    } else {
      if(p%d == 0)
        factorize(p/d,d,l+d)
      else if(d==2)
        factorize(p,d+1,l)
      else
        factorize(p,d+2,l)
    }
  }

  def main(args:Array[String]) = {
    val n = readInt
    val l = factorize(n,2,Set())
    var pi = n
    for(i <- l) {
      pi = (pi*(i-1))/i
    }
    println(pi)
  }
}