Var
s:string;
i,k:integer;
nc:boolean;
begin
readln(s);
for i:=1 to length(s) do
begin
if ( (i=1) or (s[i-1]=' ') ) and (s[i]<>' ') then
nc:=true;
if (nc=true) and ( (s[i]=' ') or (i=length(s)) then
begin
nc:=false;
inc(k);
end;
end;
writeln(k);
end.