module Main where

import Control.Monad
import Control.Applicative
import Data.List

showingList :: [Int] -> String
showingList (x:[]) = show x
showingList (x:xs) = (show x) ++ " " ++ (showingList xs)

solve :: [Int] -> Int -> Int
solve (x:xs) idx = if x == 0 then idx else solve xs (idx + 1)

main :: IO ()
main = do
    x <- map read . words <$> getLine :: IO [Int]
    print $ solve x 1
