#include <iostream>
using namespace std;

int main() {
    string s;
    while (getline(cin, s)) { // 注意 while 处理多个 case
        int count =0;
        for(char c: s){
            if(c>='A' && c<='Z')
                count++;
        }

        cout << count << endl;
    }
}