#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    if (s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ"){
        cout << 1;
        return 0;
    }
    if(n == 26){
        cout << 0;
        return 0;
    }
    int ans = 0;
    if(n == 27){
        for(int i = 0; i < n; i++){
            if(s[i] == s[i - 1] || s[i] == s[i + 1]){
                cout << 2;
                ans++;
                i = n;
            }
        }
        if (ans == 0)
            cout << 1;
    }
    return 0;
}