Var
input, output: text;
x,k: integer;
begin
assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);
k := 0;
read(input, x);
while x <> 0 do
begin
k := k + 1;
read(input, x)
end;
write(output, k);
close(input);
close(output)
end.