using System;
using System.Collections.Generic;

namespace takmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            List<int> ints = new List<int>();
            
            for (int i = 0; i < n; i++)
            {
                ints[i] = (int)s[i] % 32;
            }

            bool thingi = true;

            for (int i = 1; i < n; i++)
            {
                if (ints[i - 1] > ints[i]) thingi = false;
                
            }
            if (n <=26)
            {
                Console.WriteLine(0);
            }
            else if(n==27)
            {
                if (thingi)
                {
                    Console.WriteLine(1);
                }
                else
                {
                    Console.WriteLine(0);
                }
            }
            
        }
    }
}