var f: text; r,j: byte; s: string; begin assign(f, 'input.txt'); reset(f); readln(f,s); close(f); assign(f,'output.txt'); rewrite(f); s:=s+' '; r:=0; for j:=1 to length(s)-1 do if (s[j]<>' ') and (s[j+1]=' ') then r:=r+1; writeln(f,r); close(f) end.