#include<iostream>
using namespace std;
int main()
{
    string str;
    while(getline(cin,str))
    {
        int i=0;
        int count=0;
        while(str[i]!='\0')
        {
            if(str[i]>='A'&& str[i]<='Z')
            {
                count++;
            }
            i++;
        }
        cout<<count<<endl;
    }
    return 0;
}