import java.util.Scanner

object Mail extends App {
  val sc = new Scanner(System.in)
  def next(): String = sc.next()
  def nextInt(): Int = Integer.parseInt(next())

  def taskA(): Unit = {
    val n = next()
    println(n.count(_ == '2'))
  }

  taskA()
}
