import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInt' = fst.fromJust.C.readInt
readLnInt = map readInt'.C.words<$>C.getLine

x ? (a,b) = if x then a else b
main = do
 inputs <- readLnInt
 print $ solve inputs

solve inputs = count 1 inputs

count n (a:as) = (a==0)?(n,count (n+1) as)
