object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextLine()
    println(
      n.foldLeft(0)(
        (b:Int, c :Char) =>
          b + (if(c == '2') 1 else 0)
      )
    )
  }
}