#include <stdio.h>
#include <ctype.h>
int main() {
    char s[101];
    if(!fgets(s,sizeof(s),stdin)) {
        printf("Invalid input");
        return 0;
    }
    int i=0;
    int words=0;
    int in_words=0;
    while (s[i] != ' ' && s[i] != ' ') {
        unsigned char c =(unsigned char)s[i];
        if (c== ' ') {
            in_word=0;
        } else {
            if (!isalpha(c)){
                printf("Invalid input");
                return 0;
            }
            if (!inword) {
                word++;
                in_word = 1;
            }
        }
        i++;
    }
    printf("%d", words);
    return 0;
}