var n,count:integer;begin repeat readln(n); if(n<>999) then inc(count); until(n=999); writeln(count); readln;end.
var n,count:integer;
begin
repeat
readln(n);
if(n<>999) then inc(count);
until(n=999);
writeln(count);
readln;
end.