using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Baekjoon
{
class Program
{
static void Main(string[] args)
{
string input = Console.ReadLine() + ' ';
int count = 0;
// 반례 : 모두 공백으로 입력할 경우 문자열이 없음에도 무조건 1을 출력
for (int i = 0; i < input.Length - 1; i++)
{
if (input[i] != ' ' && input[i + 1] == ' ')
{
count += 1;
}
else
{
count += 0;
continue;
}
}
if (count == 0)
{
Console.WriteLine(0);
}
else
{
Console.WriteLine(count);
}
}
}
}