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

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n<26)
        cout<<"0";
    if(n==26)
    {
        if(s=="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
            cout<<"1";
        else
            cout<<"0";
    }
    int niz[26];
    if(n==27)
    {   for(int i=0;i<26;i++)
        {
            niz[i]=count(s.begin(),s.end(),char(65+i));
            if(niz[i]>=3 || niz[i]==0)
                {cout<<"0";
                break;}
            else if(niz[i]==2)
            {
                int k=s.find(char(65+i));
                int p=s.find_last_of(char(65+i));
                int br=0;
                string t,w;
                t=w=s;
                t.erase(k,1);
                w.erase(p,1);
                if(t == "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
                    br++;
                if(w == "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
                    br++;
                cout<<br;
                break;
            }
        }
    }
    return 0;
}