#include <iostream>
#include <string>
#include <sstream>
#include <set>

using namespace std;

int PrintResult(string msg) {
    int count = 0;
    
    // Define the set of allowed characters
    set<char> allowed = {'H', 'I', 'N', 'O', 'S', 'X', 'Z', 'W'};
    
    // Use stringstream to split the message into words
    stringstream ss(msg);
    string word;
    
    while (ss >> word) {
        bool isOutstanding = true;
        
        // Check if all characters in the word are in the allowed set
        for (char c : word) {
            if (allowed.find(c) == allowed.end()) {
                isOutstanding = false;
                break;
            }
        }
        
        // If the word is outstanding, increment the count
        if (isOutstanding) {
            count++;
        }
    }
    
    return count;
}

int main() {
    string msg;
    getline(cin, msg);
    cout << PrintResult(msg) << endl;
    return 0;
}