Module Module1
    Sub Main(ByVal args() As String)
        Dim a$ = Console.ReadLine()
        Dim ans% = 0
    	For i as integer = 1 To 4
            If Mid(a$, i, 1) = "2" Then ans% += 1
        Next
        Console.WriteLine(ans%)
  End Sub
End Module