Imports System

Module Program
    Sub Main(args As String())
        Dim sInput As String() = Console.ReadLine().Split(" ")
        If sInput(0) = "0" Then
            Console.WriteLine("1")
        ElseIf sInput(1) = "0" Then
            Console.WriteLine("2")
        ElseIf sInput(2) = "0" Then
            Console.WriteLine("3")
        ElseIf sInput(3) = "0" Then
            Console.WriteLine("4")
        Else
            Console.WriteLine("5")
        End If

    End Sub
End Module
