#include <iostream>
#include <string>
using namespace std;
int main()
{
	int n, counter1 = 0, counter2 = 0;
	cin >> n;
	string a, pomocni = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	cin >> a;
	if (n <= 25){
		cout << 0;
	}
	else if (n == 26){
		if (a == pomocni) cout << 1;
		else cout << 0;
	}
	else if (n == 27)
	{
		for (int i = 0; i < n; i++)
		{
			if ((a[i] != pomocni[i]) && (a[i + 1] != a[i]))
			{
				counter1++;
			}
			if (a[i] == a[i + 1])
			{
				counter2++;
			}
		}
		if (counter1 != 0) cout << 0;
		else if (counter2 == 0) cout << 1;
		else cout << 2;
	}
}