{ Pascal ABC.NET 3.2 }
var f: text; s: string; i, l_line, slov: integer;
begin
Assign(f, 'd:\in.txt');
Reset(f);
while not Eof(f) do begin
Readln(f,s);
s := Trim(s);
l_line := Length(s);
if l_line <> 0 then begin
for i:=1 to l_line do
if s[i] = ' ' then slov := slov + 1;
slov := slov + 1;
end;
end;
Close(f);
Assign(f, 'd:\out.txt');
Rewrite(f);
Write(f, slov);
Close(f);
end.