#include <bits/stdc++.h>

using namespace std;

int main(){
    string str = "";
    while(getline(cin, str)){
        int res = 0;
        for(char ch : str){
            if(ch >= 'A' && ch <= 'Z'){
                res++;
            }
        }
        
        cout << res << endl;
    }
    
    return 0;
}