#include <stdio.h>

int main(void)
{
	char str[1000001];
	int count = 0, result = 0;
	scanf("%[^\n]s", str);
	for (int i = 0; str[i] != '\0'; i++)
	{
		count++;
	}
	int arr[count];
	for (int i = 0; str[i] != '\0'; i++)
	{

		if (str[i] != 32)
		{
			arr[i] = 1;
		}
		else
		{
			arr[i] = 0;
		}
	}

	if (str[0] == 32 && str[1]!='\0')
	{
		for (int i = 0; i < count; i++)
			if (arr[i] == 0)
				result++;
		printf("%d\n", result);
	}
	else if (str[0] != 32)
	{
		result = 1;
		for (int i = 0; i < count; i++)
			if (arr[i] == 0)
				result++;
		printf("%d\n", result);
	}
	else if (str[0] == 32 && str[1] == '\0')
		printf("%d\n", 0);

	return 0;
}
