#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string slova;
    cin >> slova;

    if (n <= 26)
    {
        cout << 0;
    }
    else
    {
        bool flag = false;
        for (int i = 0; i < n - 1; i++)
        {
            if (slova[i] == slova[i+1])
            {
                flag = true;
                break;
            }
        }
        if (flag)
        {
            cout << 2;
        }
        else
        {
            cout << 1;
        }
    }

    return 0;
}