import java.util.*;

public class Main {
    public static void main(String[] args) {
        //write your code here......
        Scanner sc=new Scanner(System.in);
	  //定义集合保存元素,遇到0停止添加,返回集合长度-1
        ArrayList<Integer> arr=new ArrayList<Integer>();

        while(true){
            int c=sc.nextInt();
            arr.add( c);
            if(c<=0)break;
        }
        System.out.println(arr.size()-1);

        

    }
}