#include <iostream>

int main()
{
	int A;
	std::string str;

	std::cin >> A;
	std::cin >> str;

	int C = 0; 
	int i = 0;
	while ((i = str.find("ABC", i)) >= 0) {
		C = C + 1;
		i = i + 1;
	}

	std::cout << C;
}