using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string C = Console.ReadLine();
        if (N < 27) Console.WriteLine(0);
        if (N == 27)
        {
            char[] b = C.ToCharArray();
            int asc = 65;
            int isp = 1;
            for(int i = 0; i < N; i++)
            {
                if(b[i] == asc)
                {
                    asc++;
                }
                if(i!=N-1 && b[i+1] == b[i])
                {
                    isp = 2;
                }
            }
            if (asc == 91)
            {
                Console.WriteLine(isp);
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }
}