import java.util.Scanner



object Main {

  def read(): Int = {
    scala.io.StdIn.readInt()
  }


  def solve(n: Int): Int = {
    val iSeq: Seq[Int] = 1 to n
    val pSeq: Seq[Int] = iSeq.takeRight(n-1) ++ iSeq.take(1)
    val modSeq = for(i <- 0 until iSeq.length) yield {
      iSeq(i) % pSeq(i)
    }
    modSeq.sum
  }


  def main(args: Array[String]): Unit = {
    val n = read()
    println(solve(n))
  }

}
