#include <iostream>
using namespace std;

bool isNeededChar(char c) {
	switch(c) {
		case '.':
		case '!':
		case '?':
			return true;
		default:
			return false;
	}
}

int main() {
	int counter = 0;
	string text;
	getline(cin, text);
	for(int i = 1; i < text.length(); i++) {
		if(isNeededChar(text.at(i))) {
			if(!isNeededChar(text.at(i - 1))) {
				counter++;
			}
		}
	}
	cout << counter << endl;
	return 0;
}