#include <iostream>
#include <string>
using namespace std;

int main() {
    string input;
    char ch;
    int ans = 0;
    while ((ch = getchar()) != '.') {
        input += ch;
    }

    // 遍历字符串,统计大写字母的个数
    for (char c : input) {
        if (c >= 'A' && c <= 'Z') {
            ans++;
        }
    }

    // 输出结果
    cout << ans << endl;

    return 0;
}
/**************************************************************
	Problem: 1007
	User: long
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:2072 kb
****************************************************************/