#include<bits/stdc++.h>
#define fi(i,n) for(i=0;i<n;++i)

using namespace std;

/*long long a[301][301];

bool isPossible(long long a[301][301],int m,int n)
{
    int i,j;
    if(a[0][0]>2 || a[0][n-1]>2 || a[m-1][0]>2 || a[m-1][n-1]>2)
    {
        return false;
    }
    fi(i,m)
        {
            fi(j,n)
            {
                if(i==0 || j==0 || i==m-1 || j==n-1)
                {
                    if(a[i][j]>3)return false;
                }
                else{
                    if(a[i][j]>4)return false;
                }
            }
        }
    return true;
}

int main()
{
    int t,n,m,i,j;
    cin>>t;
    while(t--)
    {
        cin>>m>>n;
        fi(i,m)
        {
            fi(j,n)
            {
                cin>>a[i][j];
            }
        }
        bool possible=isPossible(a,m,n);
        if(possible)
        {
            cout<<"YES\n";
            fi(i,m)
            {
                fi(j,n)
                {
                    if((i==0 && j==0) || (i==0 && j==n-1) || (i==m-1 && j==0) || (i==m-1 && j==n-1))
                    {
                        cout<<"2 ";
                    }
                    else if(i==0 || j==0 || i==m-1 || j==n-1)cout<<"3 ";
                    else cout<<"4 ";
                }
                cout<<"\n";
            }
        }
        else{
            cout<<"NO\n";
        }
    }
}*/
/*
int main()
{
    int n,curri,currj,i,t;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];

        if(a[0]<a[n-1])cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}

int findLastOccurence(vector<int> a,int ele,int l,int r)
{
    int mid=l+(r-l)/2;
    int res=-1;
    while(l<=r)
    {
        mid=l+(r-l)/2;
        if(a[mid]==ele)
        {
            res=mid;
            l=mid+1;
        }
        else if(a[mid]<ele)
        {
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return res;
}

int findFirstOccurence(vector<int> a,int ele,int l,int r)
{
    int res=-1;
    int mid=l+(r-l)/2;
    while(l<=r)
    {
        mid=l+(r-l)/2;
        if(a[mid]==ele)
        {
            res=mid;
            r=mid-1;
        }
        else if(a[mid]<ele)
        {
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return res;
}

int main()
{
    int n,k,j;
    cin>>n>>k;
    vector<int> a(n);
    int i,ans;
    fi(i,n)cin>>a[i];

    if(a[0]==0)ans=0;
    else if(a[k-1]==0)
    {
        j=findFirstOccurence(a,a[k-1],0,a.size()-1);
        ans=j;
    }
    else{
        ans=findLastOccurence(a,a[k-1],k-1,a.size()-1)+1;
    }
    cout<<ans<<"\n";
    return 0;
}

int main()
{
    int m,n;
    cin>>m>>n;
    int tile=0;
    if(m%2!=0)
    {
        tile+=n;
        tile*=(m/2);
        tile+=(n/2);
    }
    else{
        tile+=n;
        tile*=(m/2);
    }
    cout<<tile<<"\n";
    return 0;
}

int main()
{
    int n,count=0;
    map<char,int> m;

    string s;
    cin>>s;
    n=s.size();
    int i=0;
    while(i<n)
    {
        if(!m.count(s[i]))
        {
            m[s[i]]=1;
            count++;
        }
        else{
            m[s[i]]++;
        }
        i++;
    }
    string ans=count%2!=0?"IGNORE HIM!\n":"CHAT WITH HER!\n";
    cout<<ans;
   return 0;
}
int main()
{
    int n,i,count=0,ans=INT_MIN;
    string s;
    cin>>n;
    cin>>s;
    fi(i,n-1)
    {
        while(s[i]==s[i+1] && i<n-1)
        {
            i++;
            count++;
        }
        //ans=max(ans,count);
    }
    cout<<count<<"\n";
    return 0;
}

int main()
{
    int i,countcaps=0,countlows=0;
    string s;
    cin>>s;
    int n=s.size();
    fi(i,n)
    {
        if(islower(s[i]))
        {
            countlows++;
        }
        else{
            countcaps++;
        }
    }
    if(countlows>=countcaps)
    {
        fi(i,n)
        {
            cout<<(char)tolower(s[i]);
        }
        cout<<"\n";
    }
    else{
        fi(i,n)
        {
            cout<<(char)toupper(s[i]);
        }
        cout<<"\n";
    }
    return 0;
}

long long maxPrimeFactors(long long n)
{
    // Initialize the maximum prime factor
    // variable with the lowest one
    long long maxPrime = -1;
    if(n==1)return 1;
    // Print the number of 2s that divide n
    while (n % 2 == 0) {
        maxPrime = 2;
        n >>= 1; // equivalent to n /= 2
    }

    // n must be odd at this point, thus skip
    // the even numbers and iterate only for
    // odd integers
    for (int i = 3; i <= sqrt(n); i += 2) {
        while (n % i == 0) {
            maxPrime = i;
            n = n / i;
        }
    }

    // This condition is to handle the case
    // when n is a prime number greater than 2
    if (n > 2)
        maxPrime = n;

    return maxPrime;
}

bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

int main()
{
    int t;
    cin>>t;
    int n,i;
    while(t--)
    {
        cin>>n;
        if(n%2==0)
        {
            cout<<n/2<<"\n";
        }
        else{
            cout<<(n-1)/2<<"\n";
        }
    }
    return 0;
}
int main()
{
    int n;
    cin>>n;

        int ans=ceil((float)n/5);
        cout<<ans<<"\n";

    return 0;
}
int main()
{
    int n,k,w;
    cin>>k>>n>>w;
    int sum=(w*(w+1)/2)*k;
    int ans=(sum-n)>=0?sum-n:0;
    cout<<ans;
}
int main()
{
    int n,i,tot=INT_MAX;
    cin>>n;
    vector<int> a(n);
    map<int,vector<int>> m;
    vector<int> t;
    m[1]=t;
    m[2]=t;
    m[3]=t;
    fi(i,n)
    {
        cin>>a[i];

            m[a[i]].push_back(i+1);

    }
    for(auto itr=m.begin();itr!=m.end();++itr)
    {
        if(itr->second.size()<tot)tot=itr->second.size();
    }
    cout<<tot<<"\n";
    fi(i,tot)
    {
        cout<<m[1][i]<<" ";
        cout<<m[2][i]<<" ";
        cout<<m[3][i]<<" ";
        cout<<"\n";
    }
    return 0;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b,ans=0;
        cin>>a>>b;
        int side=2*min(a,b);
        ans=max(side,max(a,b));
        ans*=ans;
        cout<<ans<<"\n";
    }
    return 0;
}
int main()
{
    int n;
    string src,dest;
    cin>>n>>src>>dest;
    int i,ans=0;
    fi(i,n)
    {
        int d=max((int)(dest[i]),(int)(src[i]));
        int s=min((int)(dest[i]),(int)(src[i]));
        int diff=min(d-s,10-d+s);
        //cout<<diff<<" ";
        ans+=diff;
    }
    cout<<ans<<"\n";
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,i=1,j=0;
        cin>>n;
        if(n%2!=0){
            cout<<i<<" ";
            n--;
        }

        while(j<n)
        {
            cout<<i<<" "<<i<<" ";
            i+=2;
            j+=2;
        }
        cout<<"\n";
    }
    return 0;
}
int main()
{
    int t,i;
    cin>>t;
    while(t--)
    {
        vector<long long int> a(3);
        long long int count=0;
        fi(i,3){
            cin>>a[i];
            count+=a[i];
        }
        cout<<(count/2)<<"\n";
    }
    return 0;
}
int main()
{
    string s;
    cin>>s;
    int n=s.size();
    int i,count=1;
    fi(i,n-1)
    {
        count=1;
        while(s[i]==s[i+1])
        {
            i++;
            count++;
        }
        if(count>=7)break;
    }
    if(count>=7)cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,i,total=0,curr=0,count=0;
    cin>>n;
    vector<int> a(n);
    priority_queue<int> pq;
    fi(i,n){
        cin>>a[i];
        total+=a[i];
        pq.push(a[i]);
    }
    while(!pq.empty() && curr<=(total/2))
    {
        curr+=pq.top();
        count++;
        pq.pop();
    }
    cout<<count;
    return 0;
}
int main()
{
    int n,i;
    cin>>n;
    map<int,int> m;
    vector<int> b(n);

    fi(i,n){
        cin>>b[i];
        if(!m.count(b[i]))
        {
            m[b[i]]=1;
        }
    }
    int ans=m.size();
    cout<<ans;
    return 0;
}
vector<int> adj[2001];
vector<bool> visited(2001,false);
int res=INT_MIN;

void dfs(int node,int height)
{
    visited[node]=true;
    int i;
    res=max(res,height);
    fi(i,adj[node].size())
    {
        //cout<<adj[node][i]<<" ";
        if(!visited[adj[node][i]])
        dfs(adj[node][i],height+1);
    }
}

int main()
{
    int n,a;
    vector<int> root;
    cin>>n;
    int i;
    fi(i,n)
    {
        cin>>a;
        if(a!=-1)
        {
            adj[i].push_back(a-1);
            adj[a-1].push_back(i);
        }
        else root.push_back(i);
    }

    for(auto i:root)
    {
        dfs(i,1);
    }

    cout<<res;
    return 0;
}

int main()
{
    long long int n,i;
    cin>>n;
    vector<long long int> a(n);
    long long int countZeroes=0,res=0,neg=0;
    fi(i,n)
    {
        cin>>a[i];
        if(a[i]==0)countZeroes++;
    }
    fi(i,n)
    {
        if(a[i]>0)
        {
            res+=(a[i]-1);
        }
        else if(a[i]<0)
        {
            neg++;
            res+=(-1-a[i]);
        }
    }
    if(countZeroes>0)
    {
        res+=countZeroes;
    }
    else{
        if(neg%2!=0)
        res+=2;
    }
    cout<<res;
    return 0;
}
int main()
{
    int n,i;

        cin>>n;
        vector<int> a(12);
        fi(i,12)cin>>a[i];
        sort(a.begin(),a.end(),greater<int>());
        int ans=0,sum=0;i=0;
        while(i<12 && sum<n)
        {
            sum+=a[i];
            i++;
            ans++;
        }
        if(sum<n)ans=-1;
        cout<<ans<<"\n";

    return 0;
}
int main()
{
    int m,n,x,t;
    cin>>t;
    while(t--)
    {
        int temp;
        cin>>x>>m>>n;
        temp=x;
        while(m-- && (temp/2+10)<temp)
        {

                temp=temp/2+10;

        }
        temp=temp-n*10;
        if(temp>0)cout<<"NO\n";
        else cout<<"YES\n";
    }
    return 0;
}
int main()
{
    int n,i;
    cin>>n;
    vector<int> a(n+1);
    vector<int> ans;
    a[1]=1;
    for(i=2;i<=n;++i)cin>>a[i];
    i=n;
    ans.push_back(n);
    while(a[i]!=1)
    {
        ans.push_back(a[i]);
        i=a[i];
    }
    ans.push_back(a[i]);
    reverse(ans.begin(),ans.end());
    fi(i,ans.size())cout<<ans[i]<<" ";
    cout<<"\n";
    return 0;
}
int main()
{
    int i,n,flag=0;
    cin>>n;
    vector<int> a(n);
    vector<int> b;
    fi(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    fi(i,n-1)
    {
        while(a[i]==a[i+1])i++;
        b.push_back(a[i]);
    }
    if(a[n-2]!=a[n-1])b.push_back(a[n-1]);
    fi(i,b.size())
    {
        if(b[i+1]-b[i]==1 && b[i+2]-b[i+1]==1)
        {
            cout<<"YES";
            flag=1;
            break;
        }
    }
    if(!flag)cout<<"NO";
    return 0;
}
int main()
{
    int count1=0,count2=0,count3=0,i,n;
    cin>>n;
    vector<int> a(n);
    fi(i,n)
    {
        cin>>a[i];
        if(a[i]==1)count1++;
        else if(a[i]==2)count2++;
        else count3++;
    }
    int maxcount=max(count1,max(count2,count3));
    int ans=n-maxcount;
    cout<<ans;
    return 0;
}
int main()
{
    string pass,s1,s2;
    cin>>pass;
    int n,i,flag=0;
    char a=pass[0];
    char b=pass[1];
    cin>>n;
    vector<string> barks(n);
    fi(i,n)cin>>barks[i];
    fi(i,n)
    {
        if(barks[i]==pass || (pass[0]==barks[i][1] && pass[1]==barks[i][0]))
        {
            flag=1;
            break;
        }
        else if(barks[i][0]==b)
        {
            s2=barks[i];
        }
        else if(barks[i][1]==a)
        {
            s1=barks[i];
        }
    }
    if(flag || (s1.size()>0 && s2.size()>0))
    cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,k,i;
    cin>>n>>k;
    vector<int> a(n);
    fi(i,n)cin>>a[i];
    if(k>n || k==0)cout<<"-1";
    else{
        sort(a.begin(),a.end());
        cout<<a[n-k]<<" "<<a[n-k];
    }
    return 0;
}
int main()
{
    long long int m,n,a;
    cin>>n>>m>>a;
    cout<<((m+a-1)/a)*((n+a-1)/a);

    return 0;
}
int main()
{
    int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];
        int flag=1;
        sort(a.begin(),a.end());
        fi(i,n-1)
        {
            if(abs(a[i+1]-a[i])>1)
            {
                flag=0;
                break;
            }
        }
        if(flag)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}
int main()
{
    int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<long long int> a(n);
        vector<long long int> b(n);
        fi(i,n)cin>>a[i];
        fi(i,n)cin>>b[i];
        long long int mina=*min_element(a.begin(),a.end());
        long long int minb=*min_element(b.begin(),b.end());
        long long int ans=0;
        fi(i,n)
        {
            ans+=max(a[i]-mina,b[i]-minb);
        }
        cout<<ans<<"\n";
    }
    return 0;
}
int main()
{
    int t,n,i,j;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];
        sort(a.begin(),a.end());
        vector<int> temp(a[n-1]+a[n-2],0);
        fi(i,n-1)
        {
            for(j=i+1;j<n;++j)
            {
                while(a[j]==a[j+1] && j<n-1)j++;
                int sum=a[i]+a[j];
                if(a[i]!=a[i+1] || !temp[sum])
                temp[sum]++;
            }
        }
        cout<<*max_element(temp.begin(),temp.end())<<"\n";
    }
    return 0;
}

int main()
{
    string s,t;
    int n,i,flag=1;
    cin>>s;
    n=s.size();
    fi(i,n)
    {
        if(s[i]=='h' && t.size()==0)
        t.push_back('h');
        else if(s[i]=='e' && t.size()==1)t.push_back('e');
        else if(s[i]=='l' && (t.size()==2 || t.size()==3))t.push_back('l');
        else if(s[i]=='o' && t.size()==4)t.push_back('o');
    }
    if(t=="hello")cout<<"YES";
    else cout<<"NO";
    return 0;
}
bool isLucky(int n)
{
    int m=n;
    while(m)
    {
        int d=m%10;
        if(d!=4 && d!=7)return false;
        m/=10;
    }
    return true;
}

int main(){
    int n,flag=0;
    cin>>n;
    if(!isLucky(n))
    {
        for(int i=2;i<=n/2;++i)
        {
            if(n%i==0)
            {
                if(isLucky(n/i))
                {
                    flag=1;
                    break;
                }
            }
        }
        if(flag)cout<<"YES";
        else cout<<"NO";
    }
    else{
        cout<<"YES";
    }
    return 0;
}
int main()
{
    int a,b,c,ans;
    cin>>a>>b>>c;
    ans=a*b*c;
    ans=max(ans,a+b*c);
    ans=max(ans,(a+b)*c);
    ans=max(ans,a+b+c);
    ans=max(ans,a*(b+c));
    ans=max(ans,a*b+c);
    cout<<ans;

    return 0;
}

int main()
{
    long long int m,n,i;
    cin>>n>>m;
    vector<long long int> a(m);
    fi(i,m)cin>>a[i];
    long long int ans=a[0]-1;
    for(i=1;i<m;++i)
    {
        if(a[i]>=a[i-1])
        {
            ans+=(a[i]-a[i-1]);
        }
        else{
            ans+=(n-a[i-1]+a[i]);
        }
    }
    cout<<ans;

    return 0;
}
bool dfs(int node,vector<int> a,vector<bool>& visited,vector<int> adj[],int dest)
{
    visited[node]=true;
    if(node==dest)return true;
    for(auto i:adj[node])
    {
        if( !visited[i])
        {
            return dfs(i,a,visited,adj,dest);
        }
    }
    return false;
}

int main()
{
    int i,n,t,flag=0;
    cin>>n>>t;
    vector<int> a(n-1);
    vector<int> adj[n+1];
    fi(i,n-1)
    {
        cin>>a[i];
        adj[i+1].push_back(i+1+a[i]);
    }
    int curr=1;
    vector<int> route;
    fi(i,n-1)
    {
        if((i+1)==curr)
        {
            route.push_back(curr);
            curr=i+1+a[i];
        }
    }
    route.push_back(curr);
    /*vector<bool> visited(n+1,false);
    bool ans=dfs(1,a,visited,adj,t);
    if(ans)cout<<"YES";
    else cout<<"NO";
    fi(i,route.size())
    {
        //cout<<route[i]<<" ";
        if(route[i]==t)
        {
            flag=1;
            break;
        }
    }//cout<<"\n";
    if(flag)cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,x,i,ans=0;
    cin>>n>>x;
    for(i=1;i<=n;++i)
    {
        if(x%i==0)
        {
            if(x/i<=n)ans++;
        }
    }
    cout<<ans;
    return 0;
}

int lcs(string a,string b)
{
    int m=a.size();
    int n=b.size();
    int dp[m+1][n+1];
    int i,j;
    fi(i,m+1)
    {
        fi(j,n+1)
        {
            if(i==0 || j==0)dp[i][j]=0;
        }
    }
    for(i=1;i<=m;++i)
    {
        for(j=1;j<=n;++j)
        {
            if(a[i]==b[j])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    return dp[m][n];
}
int main()
{
    string a,b;
    cin>>a>>b;
    int lcslen=lcs(a,b);
    int ans=lcslen;
    if(a==b)cout<<"-1";
    else cout<<max(a.size(),b.size());
    return 0;
}
int main()
{
    int n;
    cin>>n;
    float i=n,ans=0;
    while(i)
    {
        ans+=(1/i);
        i--;
    }
    cout<<ans;
    return 0;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    int n;
    cin>>n;
    if(n%2==0)
    cout<<(1<<(n/2));
    else cout<<"0";
    return 0;
}*/
int main()
{
    int n,i,ans=0;
    string s;
    map<char,int> m;
    cin>>n;
    cin>>s;
    i=0;
    while(i<n)
    {
        if(m.count(s[i])==0)
        {
            m[s[i]]=1;
        }
        else{
            m[s[i]]++;
        }
        i++;
    }
    for(auto itr=m.begin();itr!=m.end();++itr)
    {
        if(itr->second>1)ans+=itr->second-1;
    }
    cout<<ans;
    return 0;
}


#include<bits/stdc++.h>
#define fi(i,n) for(i=0;i<n;++i)

using namespace std;

/*long long a[301][301];

bool isPossible(long long a[301][301],int m,int n)
{
    int i,j;
    if(a[0][0]>2 || a[0][n-1]>2 || a[m-1][0]>2 || a[m-1][n-1]>2)
    {
        return false;
    }
    fi(i,m)
        {
            fi(j,n)
            {
                if(i==0 || j==0 || i==m-1 || j==n-1)
                {
                    if(a[i][j]>3)return false;
                }
                else{
                    if(a[i][j]>4)return false;
                }
            }
        }
    return true;
}

int main()
{
    int t,n,m,i,j;
    cin>>t;
    while(t--)
    {
        cin>>m>>n;
        fi(i,m)
        {
            fi(j,n)
            {
                cin>>a[i][j];
            }
        }
        bool possible=isPossible(a,m,n);
        if(possible)
        {
            cout<<"YES\n";
            fi(i,m)
            {
                fi(j,n)
                {
                    if((i==0 && j==0) || (i==0 && j==n-1) || (i==m-1 && j==0) || (i==m-1 && j==n-1))
                    {
                        cout<<"2 ";
                    }
                    else if(i==0 || j==0 || i==m-1 || j==n-1)cout<<"3 ";
                    else cout<<"4 ";
                }
                cout<<"\n";
            }
        }
        else{
            cout<<"NO\n";
        }
    }
}*/
/*
int main()
{
    int n,curri,currj,i,t;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];

        if(a[0]<a[n-1])cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}

int findLastOccurence(vector<int> a,int ele,int l,int r)
{
    int mid=l+(r-l)/2;
    int res=-1;
    while(l<=r)
    {
        mid=l+(r-l)/2;
        if(a[mid]==ele)
        {
            res=mid;
            l=mid+1;
        }
        else if(a[mid]<ele)
        {
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return res;
}

int findFirstOccurence(vector<int> a,int ele,int l,int r)
{
    int res=-1;
    int mid=l+(r-l)/2;
    while(l<=r)
    {
        mid=l+(r-l)/2;
        if(a[mid]==ele)
        {
            res=mid;
            r=mid-1;
        }
        else if(a[mid]<ele)
        {
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return res;
}

int main()
{
    int n,k,j;
    cin>>n>>k;
    vector<int> a(n);
    int i,ans;
    fi(i,n)cin>>a[i];

    if(a[0]==0)ans=0;
    else if(a[k-1]==0)
    {
        j=findFirstOccurence(a,a[k-1],0,a.size()-1);
        ans=j;
    }
    else{
        ans=findLastOccurence(a,a[k-1],k-1,a.size()-1)+1;
    }
    cout<<ans<<"\n";
    return 0;
}

int main()
{
    int m,n;
    cin>>m>>n;
    int tile=0;
    if(m%2!=0)
    {
        tile+=n;
        tile*=(m/2);
        tile+=(n/2);
    }
    else{
        tile+=n;
        tile*=(m/2);
    }
    cout<<tile<<"\n";
    return 0;
}

int main()
{
    int n,count=0;
    map<char,int> m;

    string s;
    cin>>s;
    n=s.size();
    int i=0;
    while(i<n)
    {
        if(!m.count(s[i]))
        {
            m[s[i]]=1;
            count++;
        }
        else{
            m[s[i]]++;
        }
        i++;
    }
    string ans=count%2!=0?"IGNORE HIM!\n":"CHAT WITH HER!\n";
    cout<<ans;
   return 0;
}
int main()
{
    int n,i,count=0,ans=INT_MIN;
    string s;
    cin>>n;
    cin>>s;
    fi(i,n-1)
    {
        while(s[i]==s[i+1] && i<n-1)
        {
            i++;
            count++;
        }
        //ans=max(ans,count);
    }
    cout<<count<<"\n";
    return 0;
}

int main()
{
    int i,countcaps=0,countlows=0;
    string s;
    cin>>s;
    int n=s.size();
    fi(i,n)
    {
        if(islower(s[i]))
        {
            countlows++;
        }
        else{
            countcaps++;
        }
    }
    if(countlows>=countcaps)
    {
        fi(i,n)
        {
            cout<<(char)tolower(s[i]);
        }
        cout<<"\n";
    }
    else{
        fi(i,n)
        {
            cout<<(char)toupper(s[i]);
        }
        cout<<"\n";
    }
    return 0;
}

long long maxPrimeFactors(long long n)
{
    // Initialize the maximum prime factor
    // variable with the lowest one
    long long maxPrime = -1;
    if(n==1)return 1;
    // Print the number of 2s that divide n
    while (n % 2 == 0) {
        maxPrime = 2;
        n >>= 1; // equivalent to n /= 2
    }

    // n must be odd at this point, thus skip
    // the even numbers and iterate only for
    // odd integers
    for (int i = 3; i <= sqrt(n); i += 2) {
        while (n % i == 0) {
            maxPrime = i;
            n = n / i;
        }
    }

    // This condition is to handle the case
    // when n is a prime number greater than 2
    if (n > 2)
        maxPrime = n;

    return maxPrime;
}

bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

int main()
{
    int t;
    cin>>t;
    int n,i;
    while(t--)
    {
        cin>>n;
        if(n%2==0)
        {
            cout<<n/2<<"\n";
        }
        else{
            cout<<(n-1)/2<<"\n";
        }
    }
    return 0;
}
int main()
{
    int n;
    cin>>n;

        int ans=ceil((float)n/5);
        cout<<ans<<"\n";

    return 0;
}
int main()
{
    int n,k,w;
    cin>>k>>n>>w;
    int sum=(w*(w+1)/2)*k;
    int ans=(sum-n)>=0?sum-n:0;
    cout<<ans;
}
int main()
{
    int n,i,tot=INT_MAX;
    cin>>n;
    vector<int> a(n);
    map<int,vector<int>> m;
    vector<int> t;
    m[1]=t;
    m[2]=t;
    m[3]=t;
    fi(i,n)
    {
        cin>>a[i];

            m[a[i]].push_back(i+1);

    }
    for(auto itr=m.begin();itr!=m.end();++itr)
    {
        if(itr->second.size()<tot)tot=itr->second.size();
    }
    cout<<tot<<"\n";
    fi(i,tot)
    {
        cout<<m[1][i]<<" ";
        cout<<m[2][i]<<" ";
        cout<<m[3][i]<<" ";
        cout<<"\n";
    }
    return 0;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b,ans=0;
        cin>>a>>b;
        int side=2*min(a,b);
        ans=max(side,max(a,b));
        ans*=ans;
        cout<<ans<<"\n";
    }
    return 0;
}
int main()
{
    int n;
    string src,dest;
    cin>>n>>src>>dest;
    int i,ans=0;
    fi(i,n)
    {
        int d=max((int)(dest[i]),(int)(src[i]));
        int s=min((int)(dest[i]),(int)(src[i]));
        int diff=min(d-s,10-d+s);
        //cout<<diff<<" ";
        ans+=diff;
    }
    cout<<ans<<"\n";
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,i=1,j=0;
        cin>>n;
        if(n%2!=0){
            cout<<i<<" ";
            n--;
        }

        while(j<n)
        {
            cout<<i<<" "<<i<<" ";
            i+=2;
            j+=2;
        }
        cout<<"\n";
    }
    return 0;
}
int main()
{
    int t,i;
    cin>>t;
    while(t--)
    {
        vector<long long int> a(3);
        long long int count=0;
        fi(i,3){
            cin>>a[i];
            count+=a[i];
        }
        cout<<(count/2)<<"\n";
    }
    return 0;
}
int main()
{
    string s;
    cin>>s;
    int n=s.size();
    int i,count=1;
    fi(i,n-1)
    {
        count=1;
        while(s[i]==s[i+1])
        {
            i++;
            count++;
        }
        if(count>=7)break;
    }
    if(count>=7)cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,i,total=0,curr=0,count=0;
    cin>>n;
    vector<int> a(n);
    priority_queue<int> pq;
    fi(i,n){
        cin>>a[i];
        total+=a[i];
        pq.push(a[i]);
    }
    while(!pq.empty() && curr<=(total/2))
    {
        curr+=pq.top();
        count++;
        pq.pop();
    }
    cout<<count;
    return 0;
}
int main()
{
    int n,i;
    cin>>n;
    map<int,int> m;
    vector<int> b(n);

    fi(i,n){
        cin>>b[i];
        if(!m.count(b[i]))
        {
            m[b[i]]=1;
        }
    }
    int ans=m.size();
    cout<<ans;
    return 0;
}
vector<int> adj[2001];
vector<bool> visited(2001,false);
int res=INT_MIN;

void dfs(int node,int height)
{
    visited[node]=true;
    int i;
    res=max(res,height);
    fi(i,adj[node].size())
    {
        //cout<<adj[node][i]<<" ";
        if(!visited[adj[node][i]])
        dfs(adj[node][i],height+1);
    }
}

int main()
{
    int n,a;
    vector<int> root;
    cin>>n;
    int i;
    fi(i,n)
    {
        cin>>a;
        if(a!=-1)
        {
            adj[i].push_back(a-1);
            adj[a-1].push_back(i);
        }
        else root.push_back(i);
    }

    for(auto i:root)
    {
        dfs(i,1);
    }

    cout<<res;
    return 0;
}

int main()
{
    long long int n,i;
    cin>>n;
    vector<long long int> a(n);
    long long int countZeroes=0,res=0,neg=0;
    fi(i,n)
    {
        cin>>a[i];
        if(a[i]==0)countZeroes++;
    }
    fi(i,n)
    {
        if(a[i]>0)
        {
            res+=(a[i]-1);
        }
        else if(a[i]<0)
        {
            neg++;
            res+=(-1-a[i]);
        }
    }
    if(countZeroes>0)
    {
        res+=countZeroes;
    }
    else{
        if(neg%2!=0)
        res+=2;
    }
    cout<<res;
    return 0;
}
int main()
{
    int n,i;

        cin>>n;
        vector<int> a(12);
        fi(i,12)cin>>a[i];
        sort(a.begin(),a.end(),greater<int>());
        int ans=0,sum=0;i=0;
        while(i<12 && sum<n)
        {
            sum+=a[i];
            i++;
            ans++;
        }
        if(sum<n)ans=-1;
        cout<<ans<<"\n";

    return 0;
}
int main()
{
    int m,n,x,t;
    cin>>t;
    while(t--)
    {
        int temp;
        cin>>x>>m>>n;
        temp=x;
        while(m-- && (temp/2+10)<temp)
        {

                temp=temp/2+10;

        }
        temp=temp-n*10;
        if(temp>0)cout<<"NO\n";
        else cout<<"YES\n";
    }
    return 0;
}
int main()
{
    int n,i;
    cin>>n;
    vector<int> a(n+1);
    vector<int> ans;
    a[1]=1;
    for(i=2;i<=n;++i)cin>>a[i];
    i=n;
    ans.push_back(n);
    while(a[i]!=1)
    {
        ans.push_back(a[i]);
        i=a[i];
    }
    ans.push_back(a[i]);
    reverse(ans.begin(),ans.end());
    fi(i,ans.size())cout<<ans[i]<<" ";
    cout<<"\n";
    return 0;
}
int main()
{
    int i,n,flag=0;
    cin>>n;
    vector<int> a(n);
    vector<int> b;
    fi(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    fi(i,n-1)
    {
        while(a[i]==a[i+1])i++;
        b.push_back(a[i]);
    }
    if(a[n-2]!=a[n-1])b.push_back(a[n-1]);
    fi(i,b.size())
    {
        if(b[i+1]-b[i]==1 && b[i+2]-b[i+1]==1)
        {
            cout<<"YES";
            flag=1;
            break;
        }
    }
    if(!flag)cout<<"NO";
    return 0;
}
int main()
{
    int count1=0,count2=0,count3=0,i,n;
    cin>>n;
    vector<int> a(n);
    fi(i,n)
    {
        cin>>a[i];
        if(a[i]==1)count1++;
        else if(a[i]==2)count2++;
        else count3++;
    }
    int maxcount=max(count1,max(count2,count3));
    int ans=n-maxcount;
    cout<<ans;
    return 0;
}
int main()
{
    string pass,s1,s2;
    cin>>pass;
    int n,i,flag=0;
    char a=pass[0];
    char b=pass[1];
    cin>>n;
    vector<string> barks(n);
    fi(i,n)cin>>barks[i];
    fi(i,n)
    {
        if(barks[i]==pass || (pass[0]==barks[i][1] && pass[1]==barks[i][0]))
        {
            flag=1;
            break;
        }
        else if(barks[i][0]==b)
        {
            s2=barks[i];
        }
        else if(barks[i][1]==a)
        {
            s1=barks[i];
        }
    }
    if(flag || (s1.size()>0 && s2.size()>0))
    cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,k,i;
    cin>>n>>k;
    vector<int> a(n);
    fi(i,n)cin>>a[i];
    if(k>n || k==0)cout<<"-1";
    else{
        sort(a.begin(),a.end());
        cout<<a[n-k]<<" "<<a[n-k];
    }
    return 0;
}
int main()
{
    long long int m,n,a;
    cin>>n>>m>>a;
    cout<<((m+a-1)/a)*((n+a-1)/a);

    return 0;
}
int main()
{
    int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];
        int flag=1;
        sort(a.begin(),a.end());
        fi(i,n-1)
        {
            if(abs(a[i+1]-a[i])>1)
            {
                flag=0;
                break;
            }
        }
        if(flag)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}
int main()
{
    int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<long long int> a(n);
        vector<long long int> b(n);
        fi(i,n)cin>>a[i];
        fi(i,n)cin>>b[i];
        long long int mina=*min_element(a.begin(),a.end());
        long long int minb=*min_element(b.begin(),b.end());
        long long int ans=0;
        fi(i,n)
        {
            ans+=max(a[i]-mina,b[i]-minb);
        }
        cout<<ans<<"\n";
    }
    return 0;
}
int main()
{
    int t,n,i,j;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];
        sort(a.begin(),a.end());
        vector<int> temp(a[n-1]+a[n-2],0);
        fi(i,n-1)
        {
            for(j=i+1;j<n;++j)
            {
                while(a[j]==a[j+1] && j<n-1)j++;
                int sum=a[i]+a[j];
                if(a[i]!=a[i+1] || !temp[sum])
                temp[sum]++;
            }
        }
        cout<<*max_element(temp.begin(),temp.end())<<"\n";
    }
    return 0;
}

int main()
{
    string s,t;
    int n,i,flag=1;
    cin>>s;
    n=s.size();
    fi(i,n)
    {
        if(s[i]=='h' && t.size()==0)
        t.push_back('h');
        else if(s[i]=='e' && t.size()==1)t.push_back('e');
        else if(s[i]=='l' && (t.size()==2 || t.size()==3))t.push_back('l');
        else if(s[i]=='o' && t.size()==4)t.push_back('o');
    }
    if(t=="hello")cout<<"YES";
    else cout<<"NO";
    return 0;
}
bool isLucky(int n)
{
    int m=n;
    while(m)
    {
        int d=m%10;
        if(d!=4 && d!=7)return false;
        m/=10;
    }
    return true;
}

int main(){
    int n,flag=0;
    cin>>n;
    if(!isLucky(n))
    {
        for(int i=2;i<=n/2;++i)
        {
            if(n%i==0)
            {
                if(isLucky(n/i))
                {
                    flag=1;
                    break;
                }
            }
        }
        if(flag)cout<<"YES";
        else cout<<"NO";
    }
    else{
        cout<<"YES";
    }
    return 0;
}
int main()
{
    int a,b,c,ans;
    cin>>a>>b>>c;
    ans=a*b*c;
    ans=max(ans,a+b*c);
    ans=max(ans,(a+b)*c);
    ans=max(ans,a+b+c);
    ans=max(ans,a*(b+c));
    ans=max(ans,a*b+c);
    cout<<ans;

    return 0;
}

int main()
{
    long long int m,n,i;
    cin>>n>>m;
    vector<long long int> a(m);
    fi(i,m)cin>>a[i];
    long long int ans=a[0]-1;
    for(i=1;i<m;++i)
    {
        if(a[i]>=a[i-1])
        {
            ans+=(a[i]-a[i-1]);
        }
        else{
            ans+=(n-a[i-1]+a[i]);
        }
    }
    cout<<ans;

    return 0;
}
bool dfs(int node,vector<int> a,vector<bool>& visited,vector<int> adj[],int dest)
{
    visited[node]=true;
    if(node==dest)return true;
    for(auto i:adj[node])
    {
        if( !visited[i])
        {
            return dfs(i,a,visited,adj,dest);
        }
    }
    return false;
}

int main()
{
    int i,n,t,flag=0;
    cin>>n>>t;
    vector<int> a(n-1);
    vector<int> adj[n+1];
    fi(i,n-1)
    {
        cin>>a[i];
        adj[i+1].push_back(i+1+a[i]);
    }
    int curr=1;
    vector<int> route;
    fi(i,n-1)
    {
        if((i+1)==curr)
        {
            route.push_back(curr);
            curr=i+1+a[i];
        }
    }
    route.push_back(curr);
    /*vector<bool> visited(n+1,false);
    bool ans=dfs(1,a,visited,adj,t);
    if(ans)cout<<"YES";
    else cout<<"NO";
    fi(i,route.size())
    {
        //cout<<route[i]<<" ";
        if(route[i]==t)
        {
            flag=1;
            break;
        }
    }//cout<<"\n";
    if(flag)cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,x,i,ans=0;
    cin>>n>>x;
    for(i=1;i<=n;++i)
    {
        if(x%i==0)
        {
            if(x/i<=n)ans++;
        }
    }
    cout<<ans;
    return 0;
}

int lcs(string a,string b)
{
    int m=a.size();
    int n=b.size();
    int dp[m+1][n+1];
    int i,j;
    fi(i,m+1)
    {
        fi(j,n+1)
        {
            if(i==0 || j==0)dp[i][j]=0;
        }
    }
    for(i=1;i<=m;++i)
    {
        for(j=1;j<=n;++j)
        {
            if(a[i]==b[j])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    return dp[m][n];
}
int main()
{
    string a,b;
    cin>>a>>b;
    int lcslen=lcs(a,b);
    int ans=lcslen;
    if(a==b)cout<<"-1";
    else cout<<max(a.size(),b.size());
    return 0;
}
int main()
{
    int n;
    cin>>n;
    float i=n,ans=0;
    while(i)
    {
        ans+=(1/i);
        i--;
    }
    cout<<ans;
    return 0;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    int n;
    cin>>n;
    if(n%2==0)
    cout<<(1<<(n/2));
    else cout<<"0";
    return 0;
}*/
int main()
{
    int n,i,ans=0;
    string s;
    map<char,int> m;
    cin>>n;
    cin>>s;
    i=0;
    while(i<n)
    {
        if(m.count(s[i])==0)
        {
            m[s[i]]=1;
        }
        else{
            m[s[i]]++;
        }
        i++;
    }
    for(auto itr=m.begin();itr!=m.end();++itr)
    {
        ans+=itr->second-1;
    }
    cout<<ans;
    return 0;
}


#include<bits/stdc++.h>
#define fi(i,n) for(i=0;i<n;++i)

using namespace std;

/*long long a[301][301];

bool isPossible(long long a[301][301],int m,int n)
{
    int i,j;
    if(a[0][0]>2 || a[0][n-1]>2 || a[m-1][0]>2 || a[m-1][n-1]>2)
    {
        return false;
    }
    fi(i,m)
        {
            fi(j,n)
            {
                if(i==0 || j==0 || i==m-1 || j==n-1)
                {
                    if(a[i][j]>3)return false;
                }
                else{
                    if(a[i][j]>4)return false;
                }
            }
        }
    return true;
}

int main()
{
    int t,n,m,i,j;
    cin>>t;
    while(t--)
    {
        cin>>m>>n;
        fi(i,m)
        {
            fi(j,n)
            {
                cin>>a[i][j];
            }
        }
        bool possible=isPossible(a,m,n);
        if(possible)
        {
            cout<<"YES\n";
            fi(i,m)
            {
                fi(j,n)
                {
                    if((i==0 && j==0) || (i==0 && j==n-1) || (i==m-1 && j==0) || (i==m-1 && j==n-1))
                    {
                        cout<<"2 ";
                    }
                    else if(i==0 || j==0 || i==m-1 || j==n-1)cout<<"3 ";
                    else cout<<"4 ";
                }
                cout<<"\n";
            }
        }
        else{
            cout<<"NO\n";
        }
    }
}*/
/*
int main()
{
    int n,curri,currj,i,t;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];

        if(a[0]<a[n-1])cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}

int findLastOccurence(vector<int> a,int ele,int l,int r)
{
    int mid=l+(r-l)/2;
    int res=-1;
    while(l<=r)
    {
        mid=l+(r-l)/2;
        if(a[mid]==ele)
        {
            res=mid;
            l=mid+1;
        }
        else if(a[mid]<ele)
        {
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return res;
}

int findFirstOccurence(vector<int> a,int ele,int l,int r)
{
    int res=-1;
    int mid=l+(r-l)/2;
    while(l<=r)
    {
        mid=l+(r-l)/2;
        if(a[mid]==ele)
        {
            res=mid;
            r=mid-1;
        }
        else if(a[mid]<ele)
        {
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return res;
}

int main()
{
    int n,k,j;
    cin>>n>>k;
    vector<int> a(n);
    int i,ans;
    fi(i,n)cin>>a[i];

    if(a[0]==0)ans=0;
    else if(a[k-1]==0)
    {
        j=findFirstOccurence(a,a[k-1],0,a.size()-1);
        ans=j;
    }
    else{
        ans=findLastOccurence(a,a[k-1],k-1,a.size()-1)+1;
    }
    cout<<ans<<"\n";
    return 0;
}

int main()
{
    int m,n;
    cin>>m>>n;
    int tile=0;
    if(m%2!=0)
    {
        tile+=n;
        tile*=(m/2);
        tile+=(n/2);
    }
    else{
        tile+=n;
        tile*=(m/2);
    }
    cout<<tile<<"\n";
    return 0;
}

int main()
{
    int n,count=0;
    map<char,int> m;

    string s;
    cin>>s;
    n=s.size();
    int i=0;
    while(i<n)
    {
        if(!m.count(s[i]))
        {
            m[s[i]]=1;
            count++;
        }
        else{
            m[s[i]]++;
        }
        i++;
    }
    string ans=count%2!=0?"IGNORE HIM!\n":"CHAT WITH HER!\n";
    cout<<ans;
   return 0;
}
int main()
{
    int n,i,count=0,ans=INT_MIN;
    string s;
    cin>>n;
    cin>>s;
    fi(i,n-1)
    {
        while(s[i]==s[i+1] && i<n-1)
        {
            i++;
            count++;
        }
        //ans=max(ans,count);
    }
    cout<<count<<"\n";
    return 0;
}

int main()
{
    int i,countcaps=0,countlows=0;
    string s;
    cin>>s;
    int n=s.size();
    fi(i,n)
    {
        if(islower(s[i]))
        {
            countlows++;
        }
        else{
            countcaps++;
        }
    }
    if(countlows>=countcaps)
    {
        fi(i,n)
        {
            cout<<(char)tolower(s[i]);
        }
        cout<<"\n";
    }
    else{
        fi(i,n)
        {
            cout<<(char)toupper(s[i]);
        }
        cout<<"\n";
    }
    return 0;
}

long long maxPrimeFactors(long long n)
{
    // Initialize the maximum prime factor
    // variable with the lowest one
    long long maxPrime = -1;
    if(n==1)return 1;
    // Print the number of 2s that divide n
    while (n % 2 == 0) {
        maxPrime = 2;
        n >>= 1; // equivalent to n /= 2
    }

    // n must be odd at this point, thus skip
    // the even numbers and iterate only for
    // odd integers
    for (int i = 3; i <= sqrt(n); i += 2) {
        while (n % i == 0) {
            maxPrime = i;
            n = n / i;
        }
    }

    // This condition is to handle the case
    // when n is a prime number greater than 2
    if (n > 2)
        maxPrime = n;

    return maxPrime;
}

bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

int main()
{
    int t;
    cin>>t;
    int n,i;
    while(t--)
    {
        cin>>n;
        if(n%2==0)
        {
            cout<<n/2<<"\n";
        }
        else{
            cout<<(n-1)/2<<"\n";
        }
    }
    return 0;
}
int main()
{
    int n;
    cin>>n;

        int ans=ceil((float)n/5);
        cout<<ans<<"\n";

    return 0;
}
int main()
{
    int n,k,w;
    cin>>k>>n>>w;
    int sum=(w*(w+1)/2)*k;
    int ans=(sum-n)>=0?sum-n:0;
    cout<<ans;
}
int main()
{
    int n,i,tot=INT_MAX;
    cin>>n;
    vector<int> a(n);
    map<int,vector<int>> m;
    vector<int> t;
    m[1]=t;
    m[2]=t;
    m[3]=t;
    fi(i,n)
    {
        cin>>a[i];

            m[a[i]].push_back(i+1);

    }
    for(auto itr=m.begin();itr!=m.end();++itr)
    {
        if(itr->second.size()<tot)tot=itr->second.size();
    }
    cout<<tot<<"\n";
    fi(i,tot)
    {
        cout<<m[1][i]<<" ";
        cout<<m[2][i]<<" ";
        cout<<m[3][i]<<" ";
        cout<<"\n";
    }
    return 0;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b,ans=0;
        cin>>a>>b;
        int side=2*min(a,b);
        ans=max(side,max(a,b));
        ans*=ans;
        cout<<ans<<"\n";
    }
    return 0;
}
int main()
{
    int n;
    string src,dest;
    cin>>n>>src>>dest;
    int i,ans=0;
    fi(i,n)
    {
        int d=max((int)(dest[i]),(int)(src[i]));
        int s=min((int)(dest[i]),(int)(src[i]));
        int diff=min(d-s,10-d+s);
        //cout<<diff<<" ";
        ans+=diff;
    }
    cout<<ans<<"\n";
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,i=1,j=0;
        cin>>n;
        if(n%2!=0){
            cout<<i<<" ";
            n--;
        }

        while(j<n)
        {
            cout<<i<<" "<<i<<" ";
            i+=2;
            j+=2;
        }
        cout<<"\n";
    }
    return 0;
}
int main()
{
    int t,i;
    cin>>t;
    while(t--)
    {
        vector<long long int> a(3);
        long long int count=0;
        fi(i,3){
            cin>>a[i];
            count+=a[i];
        }
        cout<<(count/2)<<"\n";
    }
    return 0;
}
int main()
{
    string s;
    cin>>s;
    int n=s.size();
    int i,count=1;
    fi(i,n-1)
    {
        count=1;
        while(s[i]==s[i+1])
        {
            i++;
            count++;
        }
        if(count>=7)break;
    }
    if(count>=7)cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,i,total=0,curr=0,count=0;
    cin>>n;
    vector<int> a(n);
    priority_queue<int> pq;
    fi(i,n){
        cin>>a[i];
        total+=a[i];
        pq.push(a[i]);
    }
    while(!pq.empty() && curr<=(total/2))
    {
        curr+=pq.top();
        count++;
        pq.pop();
    }
    cout<<count;
    return 0;
}
int main()
{
    int n,i;
    cin>>n;
    map<int,int> m;
    vector<int> b(n);

    fi(i,n){
        cin>>b[i];
        if(!m.count(b[i]))
        {
            m[b[i]]=1;
        }
    }
    int ans=m.size();
    cout<<ans;
    return 0;
}
vector<int> adj[2001];
vector<bool> visited(2001,false);
int res=INT_MIN;

void dfs(int node,int height)
{
    visited[node]=true;
    int i;
    res=max(res,height);
    fi(i,adj[node].size())
    {
        //cout<<adj[node][i]<<" ";
        if(!visited[adj[node][i]])
        dfs(adj[node][i],height+1);
    }
}

int main()
{
    int n,a;
    vector<int> root;
    cin>>n;
    int i;
    fi(i,n)
    {
        cin>>a;
        if(a!=-1)
        {
            adj[i].push_back(a-1);
            adj[a-1].push_back(i);
        }
        else root.push_back(i);
    }

    for(auto i:root)
    {
        dfs(i,1);
    }

    cout<<res;
    return 0;
}

int main()
{
    long long int n,i;
    cin>>n;
    vector<long long int> a(n);
    long long int countZeroes=0,res=0,neg=0;
    fi(i,n)
    {
        cin>>a[i];
        if(a[i]==0)countZeroes++;
    }
    fi(i,n)
    {
        if(a[i]>0)
        {
            res+=(a[i]-1);
        }
        else if(a[i]<0)
        {
            neg++;
            res+=(-1-a[i]);
        }
    }
    if(countZeroes>0)
    {
        res+=countZeroes;
    }
    else{
        if(neg%2!=0)
        res+=2;
    }
    cout<<res;
    return 0;
}
int main()
{
    int n,i;

        cin>>n;
        vector<int> a(12);
        fi(i,12)cin>>a[i];
        sort(a.begin(),a.end(),greater<int>());
        int ans=0,sum=0;i=0;
        while(i<12 && sum<n)
        {
            sum+=a[i];
            i++;
            ans++;
        }
        if(sum<n)ans=-1;
        cout<<ans<<"\n";

    return 0;
}
int main()
{
    int m,n,x,t;
    cin>>t;
    while(t--)
    {
        int temp;
        cin>>x>>m>>n;
        temp=x;
        while(m-- && (temp/2+10)<temp)
        {

                temp=temp/2+10;

        }
        temp=temp-n*10;
        if(temp>0)cout<<"NO\n";
        else cout<<"YES\n";
    }
    return 0;
}
int main()
{
    int n,i;
    cin>>n;
    vector<int> a(n+1);
    vector<int> ans;
    a[1]=1;
    for(i=2;i<=n;++i)cin>>a[i];
    i=n;
    ans.push_back(n);
    while(a[i]!=1)
    {
        ans.push_back(a[i]);
        i=a[i];
    }
    ans.push_back(a[i]);
    reverse(ans.begin(),ans.end());
    fi(i,ans.size())cout<<ans[i]<<" ";
    cout<<"\n";
    return 0;
}
int main()
{
    int i,n,flag=0;
    cin>>n;
    vector<int> a(n);
    vector<int> b;
    fi(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    fi(i,n-1)
    {
        while(a[i]==a[i+1])i++;
        b.push_back(a[i]);
    }
    if(a[n-2]!=a[n-1])b.push_back(a[n-1]);
    fi(i,b.size())
    {
        if(b[i+1]-b[i]==1 && b[i+2]-b[i+1]==1)
        {
            cout<<"YES";
            flag=1;
            break;
        }
    }
    if(!flag)cout<<"NO";
    return 0;
}
int main()
{
    int count1=0,count2=0,count3=0,i,n;
    cin>>n;
    vector<int> a(n);
    fi(i,n)
    {
        cin>>a[i];
        if(a[i]==1)count1++;
        else if(a[i]==2)count2++;
        else count3++;
    }
    int maxcount=max(count1,max(count2,count3));
    int ans=n-maxcount;
    cout<<ans;
    return 0;
}
int main()
{
    string pass,s1,s2;
    cin>>pass;
    int n,i,flag=0;
    char a=pass[0];
    char b=pass[1];
    cin>>n;
    vector<string> barks(n);
    fi(i,n)cin>>barks[i];
    fi(i,n)
    {
        if(barks[i]==pass || (pass[0]==barks[i][1] && pass[1]==barks[i][0]))
        {
            flag=1;
            break;
        }
        else if(barks[i][0]==b)
        {
            s2=barks[i];
        }
        else if(barks[i][1]==a)
        {
            s1=barks[i];
        }
    }
    if(flag || (s1.size()>0 && s2.size()>0))
    cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,k,i;
    cin>>n>>k;
    vector<int> a(n);
    fi(i,n)cin>>a[i];
    if(k>n || k==0)cout<<"-1";
    else{
        sort(a.begin(),a.end());
        cout<<a[n-k]<<" "<<a[n-k];
    }
    return 0;
}
int main()
{
    long long int m,n,a;
    cin>>n>>m>>a;
    cout<<((m+a-1)/a)*((n+a-1)/a);

    return 0;
}
int main()
{
    int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];
        int flag=1;
        sort(a.begin(),a.end());
        fi(i,n-1)
        {
            if(abs(a[i+1]-a[i])>1)
            {
                flag=0;
                break;
            }
        }
        if(flag)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}
int main()
{
    int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<long long int> a(n);
        vector<long long int> b(n);
        fi(i,n)cin>>a[i];
        fi(i,n)cin>>b[i];
        long long int mina=*min_element(a.begin(),a.end());
        long long int minb=*min_element(b.begin(),b.end());
        long long int ans=0;
        fi(i,n)
        {
            ans+=max(a[i]-mina,b[i]-minb);
        }
        cout<<ans<<"\n";
    }
    return 0;
}
int main()
{
    int t,n,i,j;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];
        sort(a.begin(),a.end());
        vector<int> temp(a[n-1]+a[n-2],0);
        fi(i,n-1)
        {
            for(j=i+1;j<n;++j)
            {
                while(a[j]==a[j+1] && j<n-1)j++;
                int sum=a[i]+a[j];
                if(a[i]!=a[i+1] || !temp[sum])
                temp[sum]++;
            }
        }
        cout<<*max_element(temp.begin(),temp.end())<<"\n";
    }
    return 0;
}

int main()
{
    string s,t;
    int n,i,flag=1;
    cin>>s;
    n=s.size();
    fi(i,n)
    {
        if(s[i]=='h' && t.size()==0)
        t.push_back('h');
        else if(s[i]=='e' && t.size()==1)t.push_back('e');
        else if(s[i]=='l' && (t.size()==2 || t.size()==3))t.push_back('l');
        else if(s[i]=='o' && t.size()==4)t.push_back('o');
    }
    if(t=="hello")cout<<"YES";
    else cout<<"NO";
    return 0;
}
bool isLucky(int n)
{
    int m=n;
    while(m)
    {
        int d=m%10;
        if(d!=4 && d!=7)return false;
        m/=10;
    }
    return true;
}

int main(){
    int n,flag=0;
    cin>>n;
    if(!isLucky(n))
    {
        for(int i=2;i<=n/2;++i)
        {
            if(n%i==0)
            {
                if(isLucky(n/i))
                {
                    flag=1;
                    break;
                }
            }
        }
        if(flag)cout<<"YES";
        else cout<<"NO";
    }
    else{
        cout<<"YES";
    }
    return 0;
}
int main()
{
    int a,b,c,ans;
    cin>>a>>b>>c;
    ans=a*b*c;
    ans=max(ans,a+b*c);
    ans=max(ans,(a+b)*c);
    ans=max(ans,a+b+c);
    ans=max(ans,a*(b+c));
    ans=max(ans,a*b+c);
    cout<<ans;

    return 0;
}

int main()
{
    long long int m,n,i;
    cin>>n>>m;
    vector<long long int> a(m);
    fi(i,m)cin>>a[i];
    long long int ans=a[0]-1;
    for(i=1;i<m;++i)
    {
        if(a[i]>=a[i-1])
        {
            ans+=(a[i]-a[i-1]);
        }
        else{
            ans+=(n-a[i-1]+a[i]);
        }
    }
    cout<<ans;

    return 0;
}
bool dfs(int node,vector<int> a,vector<bool>& visited,vector<int> adj[],int dest)
{
    visited[node]=true;
    if(node==dest)return true;
    for(auto i:adj[node])
    {
        if( !visited[i])
        {
            return dfs(i,a,visited,adj,dest);
        }
    }
    return false;
}

int main()
{
    int i,n,t,flag=0;
    cin>>n>>t;
    vector<int> a(n-1);
    vector<int> adj[n+1];
    fi(i,n-1)
    {
        cin>>a[i];
        adj[i+1].push_back(i+1+a[i]);
    }
    int curr=1;
    vector<int> route;
    fi(i,n-1)
    {
        if((i+1)==curr)
        {
            route.push_back(curr);
            curr=i+1+a[i];
        }
    }
    route.push_back(curr);
    /*vector<bool> visited(n+1,false);
    bool ans=dfs(1,a,visited,adj,t);
    if(ans)cout<<"YES";
    else cout<<"NO";
    fi(i,route.size())
    {
        //cout<<route[i]<<" ";
        if(route[i]==t)
        {
            flag=1;
            break;
        }
    }//cout<<"\n";
    if(flag)cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,x,i,ans=0;
    cin>>n>>x;
    for(i=1;i<=n;++i)
    {
        if(x%i==0)
        {
            if(x/i<=n)ans++;
        }
    }
    cout<<ans;
    return 0;
}

int lcs(string a,string b)
{
    int m=a.size();
    int n=b.size();
    int dp[m+1][n+1];
    int i,j;
    fi(i,m+1)
    {
        fi(j,n+1)
        {
            if(i==0 || j==0)dp[i][j]=0;
        }
    }
    for(i=1;i<=m;++i)
    {
        for(j=1;j<=n;++j)
        {
            if(a[i]==b[j])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    return dp[m][n];
}
int main()
{
    string a,b;
    cin>>a>>b;
    int lcslen=lcs(a,b);
    int ans=lcslen;
    if(a==b)cout<<"-1";
    else cout<<max(a.size(),b.size());
    return 0;
}
int main()
{
    int n;
    cin>>n;
    float i=n,ans=0;
    while(i)
    {
        ans+=(1/i);
        i--;
    }
    cout<<ans;
    return 0;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    int n;
    cin>>n;
    if(n%2==0)
    cout<<(1<<(n/2));
    else cout<<"0";
    return 0;
}*/
int main()
{
    int n,i,ans=0;
    string s;
    map<char,int> m;
    cin>>n;
    cin>>s;
    i=0;
    while(i<n)
    {
        if(m.count(s[i])==0)
        {
            m[s[i]]=1;
        }
        else{
            m[s[i]]++;
        }
        i++;
    }
    for(auto itr=m.begin();itr!=m.end();++itr)
    {
        ans+=itr->second-1;
    }
    if((26-n-ans)<0)ans=-1;
    cout<<ans;
    return 0;
}


#include<bits/stdc++.h>
#define fi(i,n) for(i=0;i<n;++i)

using namespace std;

/*long long a[301][301];

bool isPossible(long long a[301][301],int m,int n)
{
    int i,j;
    if(a[0][0]>2 || a[0][n-1]>2 || a[m-1][0]>2 || a[m-1][n-1]>2)
    {
        return false;
    }
    fi(i,m)
        {
            fi(j,n)
            {
                if(i==0 || j==0 || i==m-1 || j==n-1)
                {
                    if(a[i][j]>3)return false;
                }
                else{
                    if(a[i][j]>4)return false;
                }
            }
        }
    return true;
}

int main()
{
    int t,n,m,i,j;
    cin>>t;
    while(t--)
    {
        cin>>m>>n;
        fi(i,m)
        {
            fi(j,n)
            {
                cin>>a[i][j];
            }
        }
        bool possible=isPossible(a,m,n);
        if(possible)
        {
            cout<<"YES\n";
            fi(i,m)
            {
                fi(j,n)
                {
                    if((i==0 && j==0) || (i==0 && j==n-1) || (i==m-1 && j==0) || (i==m-1 && j==n-1))
                    {
                        cout<<"2 ";
                    }
                    else if(i==0 || j==0 || i==m-1 || j==n-1)cout<<"3 ";
                    else cout<<"4 ";
                }
                cout<<"\n";
            }
        }
        else{
            cout<<"NO\n";
        }
    }
}*/
/*
int main()
{
    int n,curri,currj,i,t;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];

        if(a[0]<a[n-1])cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}

int findLastOccurence(vector<int> a,int ele,int l,int r)
{
    int mid=l+(r-l)/2;
    int res=-1;
    while(l<=r)
    {
        mid=l+(r-l)/2;
        if(a[mid]==ele)
        {
            res=mid;
            l=mid+1;
        }
        else if(a[mid]<ele)
        {
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return res;
}

int findFirstOccurence(vector<int> a,int ele,int l,int r)
{
    int res=-1;
    int mid=l+(r-l)/2;
    while(l<=r)
    {
        mid=l+(r-l)/2;
        if(a[mid]==ele)
        {
            res=mid;
            r=mid-1;
        }
        else if(a[mid]<ele)
        {
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return res;
}

int main()
{
    int n,k,j;
    cin>>n>>k;
    vector<int> a(n);
    int i,ans;
    fi(i,n)cin>>a[i];

    if(a[0]==0)ans=0;
    else if(a[k-1]==0)
    {
        j=findFirstOccurence(a,a[k-1],0,a.size()-1);
        ans=j;
    }
    else{
        ans=findLastOccurence(a,a[k-1],k-1,a.size()-1)+1;
    }
    cout<<ans<<"\n";
    return 0;
}

int main()
{
    int m,n;
    cin>>m>>n;
    int tile=0;
    if(m%2!=0)
    {
        tile+=n;
        tile*=(m/2);
        tile+=(n/2);
    }
    else{
        tile+=n;
        tile*=(m/2);
    }
    cout<<tile<<"\n";
    return 0;
}

int main()
{
    int n,count=0;
    map<char,int> m;

    string s;
    cin>>s;
    n=s.size();
    int i=0;
    while(i<n)
    {
        if(!m.count(s[i]))
        {
            m[s[i]]=1;
            count++;
        }
        else{
            m[s[i]]++;
        }
        i++;
    }
    string ans=count%2!=0?"IGNORE HIM!\n":"CHAT WITH HER!\n";
    cout<<ans;
   return 0;
}
int main()
{
    int n,i,count=0,ans=INT_MIN;
    string s;
    cin>>n;
    cin>>s;
    fi(i,n-1)
    {
        while(s[i]==s[i+1] && i<n-1)
        {
            i++;
            count++;
        }
        //ans=max(ans,count);
    }
    cout<<count<<"\n";
    return 0;
}

int main()
{
    int i,countcaps=0,countlows=0;
    string s;
    cin>>s;
    int n=s.size();
    fi(i,n)
    {
        if(islower(s[i]))
        {
            countlows++;
        }
        else{
            countcaps++;
        }
    }
    if(countlows>=countcaps)
    {
        fi(i,n)
        {
            cout<<(char)tolower(s[i]);
        }
        cout<<"\n";
    }
    else{
        fi(i,n)
        {
            cout<<(char)toupper(s[i]);
        }
        cout<<"\n";
    }
    return 0;
}

long long maxPrimeFactors(long long n)
{
    // Initialize the maximum prime factor
    // variable with the lowest one
    long long maxPrime = -1;
    if(n==1)return 1;
    // Print the number of 2s that divide n
    while (n % 2 == 0) {
        maxPrime = 2;
        n >>= 1; // equivalent to n /= 2
    }

    // n must be odd at this point, thus skip
    // the even numbers and iterate only for
    // odd integers
    for (int i = 3; i <= sqrt(n); i += 2) {
        while (n % i == 0) {
            maxPrime = i;
            n = n / i;
        }
    }

    // This condition is to handle the case
    // when n is a prime number greater than 2
    if (n > 2)
        maxPrime = n;

    return maxPrime;
}

bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

int main()
{
    int t;
    cin>>t;
    int n,i;
    while(t--)
    {
        cin>>n;
        if(n%2==0)
        {
            cout<<n/2<<"\n";
        }
        else{
            cout<<(n-1)/2<<"\n";
        }
    }
    return 0;
}
int main()
{
    int n;
    cin>>n;

        int ans=ceil((float)n/5);
        cout<<ans<<"\n";

    return 0;
}
int main()
{
    int n,k,w;
    cin>>k>>n>>w;
    int sum=(w*(w+1)/2)*k;
    int ans=(sum-n)>=0?sum-n:0;
    cout<<ans;
}
int main()
{
    int n,i,tot=INT_MAX;
    cin>>n;
    vector<int> a(n);
    map<int,vector<int>> m;
    vector<int> t;
    m[1]=t;
    m[2]=t;
    m[3]=t;
    fi(i,n)
    {
        cin>>a[i];

            m[a[i]].push_back(i+1);

    }
    for(auto itr=m.begin();itr!=m.end();++itr)
    {
        if(itr->second.size()<tot)tot=itr->second.size();
    }
    cout<<tot<<"\n";
    fi(i,tot)
    {
        cout<<m[1][i]<<" ";
        cout<<m[2][i]<<" ";
        cout<<m[3][i]<<" ";
        cout<<"\n";
    }
    return 0;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b,ans=0;
        cin>>a>>b;
        int side=2*min(a,b);
        ans=max(side,max(a,b));
        ans*=ans;
        cout<<ans<<"\n";
    }
    return 0;
}
int main()
{
    int n;
    string src,dest;
    cin>>n>>src>>dest;
    int i,ans=0;
    fi(i,n)
    {
        int d=max((int)(dest[i]),(int)(src[i]));
        int s=min((int)(dest[i]),(int)(src[i]));
        int diff=min(d-s,10-d+s);
        //cout<<diff<<" ";
        ans+=diff;
    }
    cout<<ans<<"\n";
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,i=1,j=0;
        cin>>n;
        if(n%2!=0){
            cout<<i<<" ";
            n--;
        }

        while(j<n)
        {
            cout<<i<<" "<<i<<" ";
            i+=2;
            j+=2;
        }
        cout<<"\n";
    }
    return 0;
}
int main()
{
    int t,i;
    cin>>t;
    while(t--)
    {
        vector<long long int> a(3);
        long long int count=0;
        fi(i,3){
            cin>>a[i];
            count+=a[i];
        }
        cout<<(count/2)<<"\n";
    }
    return 0;
}
int main()
{
    string s;
    cin>>s;
    int n=s.size();
    int i,count=1;
    fi(i,n-1)
    {
        count=1;
        while(s[i]==s[i+1])
        {
            i++;
            count++;
        }
        if(count>=7)break;
    }
    if(count>=7)cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,i,total=0,curr=0,count=0;
    cin>>n;
    vector<int> a(n);
    priority_queue<int> pq;
    fi(i,n){
        cin>>a[i];
        total+=a[i];
        pq.push(a[i]);
    }
    while(!pq.empty() && curr<=(total/2))
    {
        curr+=pq.top();
        count++;
        pq.pop();
    }
    cout<<count;
    return 0;
}
int main()
{
    int n,i;
    cin>>n;
    map<int,int> m;
    vector<int> b(n);

    fi(i,n){
        cin>>b[i];
        if(!m.count(b[i]))
        {
            m[b[i]]=1;
        }
    }
    int ans=m.size();
    cout<<ans;
    return 0;
}
vector<int> adj[2001];
vector<bool> visited(2001,false);
int res=INT_MIN;

void dfs(int node,int height)
{
    visited[node]=true;
    int i;
    res=max(res,height);
    fi(i,adj[node].size())
    {
        //cout<<adj[node][i]<<" ";
        if(!visited[adj[node][i]])
        dfs(adj[node][i],height+1);
    }
}

int main()
{
    int n,a;
    vector<int> root;
    cin>>n;
    int i;
    fi(i,n)
    {
        cin>>a;
        if(a!=-1)
        {
            adj[i].push_back(a-1);
            adj[a-1].push_back(i);
        }
        else root.push_back(i);
    }

    for(auto i:root)
    {
        dfs(i,1);
    }

    cout<<res;
    return 0;
}

int main()
{
    long long int n,i;
    cin>>n;
    vector<long long int> a(n);
    long long int countZeroes=0,res=0,neg=0;
    fi(i,n)
    {
        cin>>a[i];
        if(a[i]==0)countZeroes++;
    }
    fi(i,n)
    {
        if(a[i]>0)
        {
            res+=(a[i]-1);
        }
        else if(a[i]<0)
        {
            neg++;
            res+=(-1-a[i]);
        }
    }
    if(countZeroes>0)
    {
        res+=countZeroes;
    }
    else{
        if(neg%2!=0)
        res+=2;
    }
    cout<<res;
    return 0;
}
int main()
{
    int n,i;

        cin>>n;
        vector<int> a(12);
        fi(i,12)cin>>a[i];
        sort(a.begin(),a.end(),greater<int>());
        int ans=0,sum=0;i=0;
        while(i<12 && sum<n)
        {
            sum+=a[i];
            i++;
            ans++;
        }
        if(sum<n)ans=-1;
        cout<<ans<<"\n";

    return 0;
}
int main()
{
    int m,n,x,t;
    cin>>t;
    while(t--)
    {
        int temp;
        cin>>x>>m>>n;
        temp=x;
        while(m-- && (temp/2+10)<temp)
        {

                temp=temp/2+10;

        }
        temp=temp-n*10;
        if(temp>0)cout<<"NO\n";
        else cout<<"YES\n";
    }
    return 0;
}
int main()
{
    int n,i;
    cin>>n;
    vector<int> a(n+1);
    vector<int> ans;
    a[1]=1;
    for(i=2;i<=n;++i)cin>>a[i];
    i=n;
    ans.push_back(n);
    while(a[i]!=1)
    {
        ans.push_back(a[i]);
        i=a[i];
    }
    ans.push_back(a[i]);
    reverse(ans.begin(),ans.end());
    fi(i,ans.size())cout<<ans[i]<<" ";
    cout<<"\n";
    return 0;
}
int main()
{
    int i,n,flag=0;
    cin>>n;
    vector<int> a(n);
    vector<int> b;
    fi(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    fi(i,n-1)
    {
        while(a[i]==a[i+1])i++;
        b.push_back(a[i]);
    }
    if(a[n-2]!=a[n-1])b.push_back(a[n-1]);
    fi(i,b.size())
    {
        if(b[i+1]-b[i]==1 && b[i+2]-b[i+1]==1)
        {
            cout<<"YES";
            flag=1;
            break;
        }
    }
    if(!flag)cout<<"NO";
    return 0;
}
int main()
{
    int count1=0,count2=0,count3=0,i,n;
    cin>>n;
    vector<int> a(n);
    fi(i,n)
    {
        cin>>a[i];
        if(a[i]==1)count1++;
        else if(a[i]==2)count2++;
        else count3++;
    }
    int maxcount=max(count1,max(count2,count3));
    int ans=n-maxcount;
    cout<<ans;
    return 0;
}
int main()
{
    string pass,s1,s2;
    cin>>pass;
    int n,i,flag=0;
    char a=pass[0];
    char b=pass[1];
    cin>>n;
    vector<string> barks(n);
    fi(i,n)cin>>barks[i];
    fi(i,n)
    {
        if(barks[i]==pass || (pass[0]==barks[i][1] && pass[1]==barks[i][0]))
        {
            flag=1;
            break;
        }
        else if(barks[i][0]==b)
        {
            s2=barks[i];
        }
        else if(barks[i][1]==a)
        {
            s1=barks[i];
        }
    }
    if(flag || (s1.size()>0 && s2.size()>0))
    cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,k,i;
    cin>>n>>k;
    vector<int> a(n);
    fi(i,n)cin>>a[i];
    if(k>n || k==0)cout<<"-1";
    else{
        sort(a.begin(),a.end());
        cout<<a[n-k]<<" "<<a[n-k];
    }
    return 0;
}
int main()
{
    long long int m,n,a;
    cin>>n>>m>>a;
    cout<<((m+a-1)/a)*((n+a-1)/a);

    return 0;
}
int main()
{
    int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];
        int flag=1;
        sort(a.begin(),a.end());
        fi(i,n-1)
        {
            if(abs(a[i+1]-a[i])>1)
            {
                flag=0;
                break;
            }
        }
        if(flag)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}
int main()
{
    int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<long long int> a(n);
        vector<long long int> b(n);
        fi(i,n)cin>>a[i];
        fi(i,n)cin>>b[i];
        long long int mina=*min_element(a.begin(),a.end());
        long long int minb=*min_element(b.begin(),b.end());
        long long int ans=0;
        fi(i,n)
        {
            ans+=max(a[i]-mina,b[i]-minb);
        }
        cout<<ans<<"\n";
    }
    return 0;
}
int main()
{
    int t,n,i,j;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];
        sort(a.begin(),a.end());
        vector<int> temp(a[n-1]+a[n-2],0);
        fi(i,n-1)
        {
            for(j=i+1;j<n;++j)
            {
                while(a[j]==a[j+1] && j<n-1)j++;
                int sum=a[i]+a[j];
                if(a[i]!=a[i+1] || !temp[sum])
                temp[sum]++;
            }
        }
        cout<<*max_element(temp.begin(),temp.end())<<"\n";
    }
    return 0;
}

int main()
{
    string s,t;
    int n,i,flag=1;
    cin>>s;
    n=s.size();
    fi(i,n)
    {
        if(s[i]=='h' && t.size()==0)
        t.push_back('h');
        else if(s[i]=='e' && t.size()==1)t.push_back('e');
        else if(s[i]=='l' && (t.size()==2 || t.size()==3))t.push_back('l');
        else if(s[i]=='o' && t.size()==4)t.push_back('o');
    }
    if(t=="hello")cout<<"YES";
    else cout<<"NO";
    return 0;
}
bool isLucky(int n)
{
    int m=n;
    while(m)
    {
        int d=m%10;
        if(d!=4 && d!=7)return false;
        m/=10;
    }
    return true;
}

int main(){
    int n,flag=0;
    cin>>n;
    if(!isLucky(n))
    {
        for(int i=2;i<=n/2;++i)
        {
            if(n%i==0)
            {
                if(isLucky(n/i))
                {
                    flag=1;
                    break;
                }
            }
        }
        if(flag)cout<<"YES";
        else cout<<"NO";
    }
    else{
        cout<<"YES";
    }
    return 0;
}
int main()
{
    int a,b,c,ans;
    cin>>a>>b>>c;
    ans=a*b*c;
    ans=max(ans,a+b*c);
    ans=max(ans,(a+b)*c);
    ans=max(ans,a+b+c);
    ans=max(ans,a*(b+c));
    ans=max(ans,a*b+c);
    cout<<ans;

    return 0;
}

int main()
{
    long long int m,n,i;
    cin>>n>>m;
    vector<long long int> a(m);
    fi(i,m)cin>>a[i];
    long long int ans=a[0]-1;
    for(i=1;i<m;++i)
    {
        if(a[i]>=a[i-1])
        {
            ans+=(a[i]-a[i-1]);
        }
        else{
            ans+=(n-a[i-1]+a[i]);
        }
    }
    cout<<ans;

    return 0;
}
bool dfs(int node,vector<int> a,vector<bool>& visited,vector<int> adj[],int dest)
{
    visited[node]=true;
    if(node==dest)return true;
    for(auto i:adj[node])
    {
        if( !visited[i])
        {
            return dfs(i,a,visited,adj,dest);
        }
    }
    return false;
}

int main()
{
    int i,n,t,flag=0;
    cin>>n>>t;
    vector<int> a(n-1);
    vector<int> adj[n+1];
    fi(i,n-1)
    {
        cin>>a[i];
        adj[i+1].push_back(i+1+a[i]);
    }
    int curr=1;
    vector<int> route;
    fi(i,n-1)
    {
        if((i+1)==curr)
        {
            route.push_back(curr);
            curr=i+1+a[i];
        }
    }
    route.push_back(curr);
    /*vector<bool> visited(n+1,false);
    bool ans=dfs(1,a,visited,adj,t);
    if(ans)cout<<"YES";
    else cout<<"NO";
    fi(i,route.size())
    {
        //cout<<route[i]<<" ";
        if(route[i]==t)
        {
            flag=1;
            break;
        }
    }//cout<<"\n";
    if(flag)cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,x,i,ans=0;
    cin>>n>>x;
    for(i=1;i<=n;++i)
    {
        if(x%i==0)
        {
            if(x/i<=n)ans++;
        }
    }
    cout<<ans;
    return 0;
}

int lcs(string a,string b)
{
    int m=a.size();
    int n=b.size();
    int dp[m+1][n+1];
    int i,j;
    fi(i,m+1)
    {
        fi(j,n+1)
        {
            if(i==0 || j==0)dp[i][j]=0;
        }
    }
    for(i=1;i<=m;++i)
    {
        for(j=1;j<=n;++j)
        {
            if(a[i]==b[j])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    return dp[m][n];
}
int main()
{
    string a,b;
    cin>>a>>b;
    int lcslen=lcs(a,b);
    int ans=lcslen;
    if(a==b)cout<<"-1";
    else cout<<max(a.size(),b.size());
    return 0;
}
int main()
{
    int n;
    cin>>n;
    float i=n,ans=0;
    while(i)
    {
        ans+=(1/i);
        i--;
    }
    cout<<ans;
    return 0;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    int n;
    cin>>n;
    if(n%2==0)
    cout<<(1<<(n/2));
    else cout<<"0";
    return 0;
}*/
int main()
{
    int n,i,ans=0;
    string s;
    map<char,int> m;
    cin>>n;
    cin>>s;
    i=0;
    while(i<n)
    {
        if(m.count(s[i])==0)
        {
            m[s[i]]=1;
        }
        else{
            m[s[i]]++;
        }
        i++;
    }
    for(auto itr=m.begin();itr!=m.end();++itr)
    {
        if(itr->second>1)ans++;
    }
    cout<<ans;
    return 0;
}


#include<bits/stdc++.h>
#define fi(i,n) for(i=0;i<n;++i)

using namespace std;

/*long long a[301][301];

bool isPossible(long long a[301][301],int m,int n)
{
    int i,j;
    if(a[0][0]>2 || a[0][n-1]>2 || a[m-1][0]>2 || a[m-1][n-1]>2)
    {
        return false;
    }
    fi(i,m)
        {
            fi(j,n)
            {
                if(i==0 || j==0 || i==m-1 || j==n-1)
                {
                    if(a[i][j]>3)return false;
                }
                else{
                    if(a[i][j]>4)return false;
                }
            }
        }
    return true;
}

int main()
{
    int t,n,m,i,j;
    cin>>t;
    while(t--)
    {
        cin>>m>>n;
        fi(i,m)
        {
            fi(j,n)
            {
                cin>>a[i][j];
            }
        }
        bool possible=isPossible(a,m,n);
        if(possible)
        {
            cout<<"YES\n";
            fi(i,m)
            {
                fi(j,n)
                {
                    if((i==0 && j==0) || (i==0 && j==n-1) || (i==m-1 && j==0) || (i==m-1 && j==n-1))
                    {
                        cout<<"2 ";
                    }
                    else if(i==0 || j==0 || i==m-1 || j==n-1)cout<<"3 ";
                    else cout<<"4 ";
                }
                cout<<"\n";
            }
        }
        else{
            cout<<"NO\n";
        }
    }
}*/
/*
int main()
{
    int n,curri,currj,i,t;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];

        if(a[0]<a[n-1])cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}

int findLastOccurence(vector<int> a,int ele,int l,int r)
{
    int mid=l+(r-l)/2;
    int res=-1;
    while(l<=r)
    {
        mid=l+(r-l)/2;
        if(a[mid]==ele)
        {
            res=mid;
            l=mid+1;
        }
        else if(a[mid]<ele)
        {
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return res;
}

int findFirstOccurence(vector<int> a,int ele,int l,int r)
{
    int res=-1;
    int mid=l+(r-l)/2;
    while(l<=r)
    {
        mid=l+(r-l)/2;
        if(a[mid]==ele)
        {
            res=mid;
            r=mid-1;
        }
        else if(a[mid]<ele)
        {
            r=mid-1;
        }
        else{
            l=mid+1;
        }
    }
    return res;
}

int main()
{
    int n,k,j;
    cin>>n>>k;
    vector<int> a(n);
    int i,ans;
    fi(i,n)cin>>a[i];

    if(a[0]==0)ans=0;
    else if(a[k-1]==0)
    {
        j=findFirstOccurence(a,a[k-1],0,a.size()-1);
        ans=j;
    }
    else{
        ans=findLastOccurence(a,a[k-1],k-1,a.size()-1)+1;
    }
    cout<<ans<<"\n";
    return 0;
}

int main()
{
    int m,n;
    cin>>m>>n;
    int tile=0;
    if(m%2!=0)
    {
        tile+=n;
        tile*=(m/2);
        tile+=(n/2);
    }
    else{
        tile+=n;
        tile*=(m/2);
    }
    cout<<tile<<"\n";
    return 0;
}

int main()
{
    int n,count=0;
    map<char,int> m;

    string s;
    cin>>s;
    n=s.size();
    int i=0;
    while(i<n)
    {
        if(!m.count(s[i]))
        {
            m[s[i]]=1;
            count++;
        }
        else{
            m[s[i]]++;
        }
        i++;
    }
    string ans=count%2!=0?"IGNORE HIM!\n":"CHAT WITH HER!\n";
    cout<<ans;
   return 0;
}
int main()
{
    int n,i,count=0,ans=INT_MIN;
    string s;
    cin>>n;
    cin>>s;
    fi(i,n-1)
    {
        while(s[i]==s[i+1] && i<n-1)
        {
            i++;
            count++;
        }
        //ans=max(ans,count);
    }
    cout<<count<<"\n";
    return 0;
}

int main()
{
    int i,countcaps=0,countlows=0;
    string s;
    cin>>s;
    int n=s.size();
    fi(i,n)
    {
        if(islower(s[i]))
        {
            countlows++;
        }
        else{
            countcaps++;
        }
    }
    if(countlows>=countcaps)
    {
        fi(i,n)
        {
            cout<<(char)tolower(s[i]);
        }
        cout<<"\n";
    }
    else{
        fi(i,n)
        {
            cout<<(char)toupper(s[i]);
        }
        cout<<"\n";
    }
    return 0;
}

long long maxPrimeFactors(long long n)
{
    // Initialize the maximum prime factor
    // variable with the lowest one
    long long maxPrime = -1;
    if(n==1)return 1;
    // Print the number of 2s that divide n
    while (n % 2 == 0) {
        maxPrime = 2;
        n >>= 1; // equivalent to n /= 2
    }

    // n must be odd at this point, thus skip
    // the even numbers and iterate only for
    // odd integers
    for (int i = 3; i <= sqrt(n); i += 2) {
        while (n % i == 0) {
            maxPrime = i;
            n = n / i;
        }
    }

    // This condition is to handle the case
    // when n is a prime number greater than 2
    if (n > 2)
        maxPrime = n;

    return maxPrime;
}

bool isPrime(int n)
{
    // Corner cases
    if (n <= 1)  return false;
    if (n <= 3)  return true;

    // This is checked so that we can skip
    // middle five numbers in below loop
    if (n%2 == 0 || n%3 == 0) return false;

    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;

    return true;
}

int main()
{
    int t;
    cin>>t;
    int n,i;
    while(t--)
    {
        cin>>n;
        if(n%2==0)
        {
            cout<<n/2<<"\n";
        }
        else{
            cout<<(n-1)/2<<"\n";
        }
    }
    return 0;
}
int main()
{
    int n;
    cin>>n;

        int ans=ceil((float)n/5);
        cout<<ans<<"\n";

    return 0;
}
int main()
{
    int n,k,w;
    cin>>k>>n>>w;
    int sum=(w*(w+1)/2)*k;
    int ans=(sum-n)>=0?sum-n:0;
    cout<<ans;
}
int main()
{
    int n,i,tot=INT_MAX;
    cin>>n;
    vector<int> a(n);
    map<int,vector<int>> m;
    vector<int> t;
    m[1]=t;
    m[2]=t;
    m[3]=t;
    fi(i,n)
    {
        cin>>a[i];

            m[a[i]].push_back(i+1);

    }
    for(auto itr=m.begin();itr!=m.end();++itr)
    {
        if(itr->second.size()<tot)tot=itr->second.size();
    }
    cout<<tot<<"\n";
    fi(i,tot)
    {
        cout<<m[1][i]<<" ";
        cout<<m[2][i]<<" ";
        cout<<m[3][i]<<" ";
        cout<<"\n";
    }
    return 0;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b,ans=0;
        cin>>a>>b;
        int side=2*min(a,b);
        ans=max(side,max(a,b));
        ans*=ans;
        cout<<ans<<"\n";
    }
    return 0;
}
int main()
{
    int n;
    string src,dest;
    cin>>n>>src>>dest;
    int i,ans=0;
    fi(i,n)
    {
        int d=max((int)(dest[i]),(int)(src[i]));
        int s=min((int)(dest[i]),(int)(src[i]));
        int diff=min(d-s,10-d+s);
        //cout<<diff<<" ";
        ans+=diff;
    }
    cout<<ans<<"\n";
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,i=1,j=0;
        cin>>n;
        if(n%2!=0){
            cout<<i<<" ";
            n--;
        }

        while(j<n)
        {
            cout<<i<<" "<<i<<" ";
            i+=2;
            j+=2;
        }
        cout<<"\n";
    }
    return 0;
}
int main()
{
    int t,i;
    cin>>t;
    while(t--)
    {
        vector<long long int> a(3);
        long long int count=0;
        fi(i,3){
            cin>>a[i];
            count+=a[i];
        }
        cout<<(count/2)<<"\n";
    }
    return 0;
}
int main()
{
    string s;
    cin>>s;
    int n=s.size();
    int i,count=1;
    fi(i,n-1)
    {
        count=1;
        while(s[i]==s[i+1])
        {
            i++;
            count++;
        }
        if(count>=7)break;
    }
    if(count>=7)cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,i,total=0,curr=0,count=0;
    cin>>n;
    vector<int> a(n);
    priority_queue<int> pq;
    fi(i,n){
        cin>>a[i];
        total+=a[i];
        pq.push(a[i]);
    }
    while(!pq.empty() && curr<=(total/2))
    {
        curr+=pq.top();
        count++;
        pq.pop();
    }
    cout<<count;
    return 0;
}
int main()
{
    int n,i;
    cin>>n;
    map<int,int> m;
    vector<int> b(n);

    fi(i,n){
        cin>>b[i];
        if(!m.count(b[i]))
        {
            m[b[i]]=1;
        }
    }
    int ans=m.size();
    cout<<ans;
    return 0;
}
vector<int> adj[2001];
vector<bool> visited(2001,false);
int res=INT_MIN;

void dfs(int node,int height)
{
    visited[node]=true;
    int i;
    res=max(res,height);
    fi(i,adj[node].size())
    {
        //cout<<adj[node][i]<<" ";
        if(!visited[adj[node][i]])
        dfs(adj[node][i],height+1);
    }
}

int main()
{
    int n,a;
    vector<int> root;
    cin>>n;
    int i;
    fi(i,n)
    {
        cin>>a;
        if(a!=-1)
        {
            adj[i].push_back(a-1);
            adj[a-1].push_back(i);
        }
        else root.push_back(i);
    }

    for(auto i:root)
    {
        dfs(i,1);
    }

    cout<<res;
    return 0;
}

int main()
{
    long long int n,i;
    cin>>n;
    vector<long long int> a(n);
    long long int countZeroes=0,res=0,neg=0;
    fi(i,n)
    {
        cin>>a[i];
        if(a[i]==0)countZeroes++;
    }
    fi(i,n)
    {
        if(a[i]>0)
        {
            res+=(a[i]-1);
        }
        else if(a[i]<0)
        {
            neg++;
            res+=(-1-a[i]);
        }
    }
    if(countZeroes>0)
    {
        res+=countZeroes;
    }
    else{
        if(neg%2!=0)
        res+=2;
    }
    cout<<res;
    return 0;
}
int main()
{
    int n,i;

        cin>>n;
        vector<int> a(12);
        fi(i,12)cin>>a[i];
        sort(a.begin(),a.end(),greater<int>());
        int ans=0,sum=0;i=0;
        while(i<12 && sum<n)
        {
            sum+=a[i];
            i++;
            ans++;
        }
        if(sum<n)ans=-1;
        cout<<ans<<"\n";

    return 0;
}
int main()
{
    int m,n,x,t;
    cin>>t;
    while(t--)
    {
        int temp;
        cin>>x>>m>>n;
        temp=x;
        while(m-- && (temp/2+10)<temp)
        {

                temp=temp/2+10;

        }
        temp=temp-n*10;
        if(temp>0)cout<<"NO\n";
        else cout<<"YES\n";
    }
    return 0;
}
int main()
{
    int n,i;
    cin>>n;
    vector<int> a(n+1);
    vector<int> ans;
    a[1]=1;
    for(i=2;i<=n;++i)cin>>a[i];
    i=n;
    ans.push_back(n);
    while(a[i]!=1)
    {
        ans.push_back(a[i]);
        i=a[i];
    }
    ans.push_back(a[i]);
    reverse(ans.begin(),ans.end());
    fi(i,ans.size())cout<<ans[i]<<" ";
    cout<<"\n";
    return 0;
}
int main()
{
    int i,n,flag=0;
    cin>>n;
    vector<int> a(n);
    vector<int> b;
    fi(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    fi(i,n-1)
    {
        while(a[i]==a[i+1])i++;
        b.push_back(a[i]);
    }
    if(a[n-2]!=a[n-1])b.push_back(a[n-1]);
    fi(i,b.size())
    {
        if(b[i+1]-b[i]==1 && b[i+2]-b[i+1]==1)
        {
            cout<<"YES";
            flag=1;
            break;
        }
    }
    if(!flag)cout<<"NO";
    return 0;
}
int main()
{
    int count1=0,count2=0,count3=0,i,n;
    cin>>n;
    vector<int> a(n);
    fi(i,n)
    {
        cin>>a[i];
        if(a[i]==1)count1++;
        else if(a[i]==2)count2++;
        else count3++;
    }
    int maxcount=max(count1,max(count2,count3));
    int ans=n-maxcount;
    cout<<ans;
    return 0;
}
int main()
{
    string pass,s1,s2;
    cin>>pass;
    int n,i,flag=0;
    char a=pass[0];
    char b=pass[1];
    cin>>n;
    vector<string> barks(n);
    fi(i,n)cin>>barks[i];
    fi(i,n)
    {
        if(barks[i]==pass || (pass[0]==barks[i][1] && pass[1]==barks[i][0]))
        {
            flag=1;
            break;
        }
        else if(barks[i][0]==b)
        {
            s2=barks[i];
        }
        else if(barks[i][1]==a)
        {
            s1=barks[i];
        }
    }
    if(flag || (s1.size()>0 && s2.size()>0))
    cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,k,i;
    cin>>n>>k;
    vector<int> a(n);
    fi(i,n)cin>>a[i];
    if(k>n || k==0)cout<<"-1";
    else{
        sort(a.begin(),a.end());
        cout<<a[n-k]<<" "<<a[n-k];
    }
    return 0;
}
int main()
{
    long long int m,n,a;
    cin>>n>>m>>a;
    cout<<((m+a-1)/a)*((n+a-1)/a);

    return 0;
}
int main()
{
    int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];
        int flag=1;
        sort(a.begin(),a.end());
        fi(i,n-1)
        {
            if(abs(a[i+1]-a[i])>1)
            {
                flag=0;
                break;
            }
        }
        if(flag)cout<<"YES\n";
        else cout<<"NO\n";
    }
    return 0;
}
int main()
{
    int t,n,i;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<long long int> a(n);
        vector<long long int> b(n);
        fi(i,n)cin>>a[i];
        fi(i,n)cin>>b[i];
        long long int mina=*min_element(a.begin(),a.end());
        long long int minb=*min_element(b.begin(),b.end());
        long long int ans=0;
        fi(i,n)
        {
            ans+=max(a[i]-mina,b[i]-minb);
        }
        cout<<ans<<"\n";
    }
    return 0;
}
int main()
{
    int t,n,i,j;
    cin>>t;
    while(t--)
    {
        cin>>n;
        vector<int> a(n);
        fi(i,n)cin>>a[i];
        sort(a.begin(),a.end());
        vector<int> temp(a[n-1]+a[n-2],0);
        fi(i,n-1)
        {
            for(j=i+1;j<n;++j)
            {
                while(a[j]==a[j+1] && j<n-1)j++;
                int sum=a[i]+a[j];
                if(a[i]!=a[i+1] || !temp[sum])
                temp[sum]++;
            }
        }
        cout<<*max_element(temp.begin(),temp.end())<<"\n";
    }
    return 0;
}

int main()
{
    string s,t;
    int n,i,flag=1;
    cin>>s;
    n=s.size();
    fi(i,n)
    {
        if(s[i]=='h' && t.size()==0)
        t.push_back('h');
        else if(s[i]=='e' && t.size()==1)t.push_back('e');
        else if(s[i]=='l' && (t.size()==2 || t.size()==3))t.push_back('l');
        else if(s[i]=='o' && t.size()==4)t.push_back('o');
    }
    if(t=="hello")cout<<"YES";
    else cout<<"NO";
    return 0;
}
bool isLucky(int n)
{
    int m=n;
    while(m)
    {
        int d=m%10;
        if(d!=4 && d!=7)return false;
        m/=10;
    }
    return true;
}

int main(){
    int n,flag=0;
    cin>>n;
    if(!isLucky(n))
    {
        for(int i=2;i<=n/2;++i)
        {
            if(n%i==0)
            {
                if(isLucky(n/i))
                {
                    flag=1;
                    break;
                }
            }
        }
        if(flag)cout<<"YES";
        else cout<<"NO";
    }
    else{
        cout<<"YES";
    }
    return 0;
}
int main()
{
    int a,b,c,ans;
    cin>>a>>b>>c;
    ans=a*b*c;
    ans=max(ans,a+b*c);
    ans=max(ans,(a+b)*c);
    ans=max(ans,a+b+c);
    ans=max(ans,a*(b+c));
    ans=max(ans,a*b+c);
    cout<<ans;

    return 0;
}

int main()
{
    long long int m,n,i;
    cin>>n>>m;
    vector<long long int> a(m);
    fi(i,m)cin>>a[i];
    long long int ans=a[0]-1;
    for(i=1;i<m;++i)
    {
        if(a[i]>=a[i-1])
        {
            ans+=(a[i]-a[i-1]);
        }
        else{
            ans+=(n-a[i-1]+a[i]);
        }
    }
    cout<<ans;

    return 0;
}
bool dfs(int node,vector<int> a,vector<bool>& visited,vector<int> adj[],int dest)
{
    visited[node]=true;
    if(node==dest)return true;
    for(auto i:adj[node])
    {
        if( !visited[i])
        {
            return dfs(i,a,visited,adj,dest);
        }
    }
    return false;
}

int main()
{
    int i,n,t,flag=0;
    cin>>n>>t;
    vector<int> a(n-1);
    vector<int> adj[n+1];
    fi(i,n-1)
    {
        cin>>a[i];
        adj[i+1].push_back(i+1+a[i]);
    }
    int curr=1;
    vector<int> route;
    fi(i,n-1)
    {
        if((i+1)==curr)
        {
            route.push_back(curr);
            curr=i+1+a[i];
        }
    }
    route.push_back(curr);
    /*vector<bool> visited(n+1,false);
    bool ans=dfs(1,a,visited,adj,t);
    if(ans)cout<<"YES";
    else cout<<"NO";
    fi(i,route.size())
    {
        //cout<<route[i]<<" ";
        if(route[i]==t)
        {
            flag=1;
            break;
        }
    }//cout<<"\n";
    if(flag)cout<<"YES";
    else cout<<"NO";
    return 0;
}
int main()
{
    int n,x,i,ans=0;
    cin>>n>>x;
    for(i=1;i<=n;++i)
    {
        if(x%i==0)
        {
            if(x/i<=n)ans++;
        }
    }
    cout<<ans;
    return 0;
}

int lcs(string a,string b)
{
    int m=a.size();
    int n=b.size();
    int dp[m+1][n+1];
    int i,j;
    fi(i,m+1)
    {
        fi(j,n+1)
        {
            if(i==0 || j==0)dp[i][j]=0;
        }
    }
    for(i=1;i<=m;++i)
    {
        for(j=1;j<=n;++j)
        {
            if(a[i]==b[j])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    return dp[m][n];
}
int main()
{
    string a,b;
    cin>>a>>b;
    int lcslen=lcs(a,b);
    int ans=lcslen;
    if(a==b)cout<<"-1";
    else cout<<max(a.size(),b.size());
    return 0;
}
int main()
{
    int n;
    cin>>n;
    float i=n,ans=0;
    while(i)
    {
        ans+=(1/i);
        i--;
    }
    cout<<ans;
    return 0;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    int n;
    cin>>n;
    if(n%2==0)
    cout<<(1<<(n/2));
    else cout<<"0";
    return 0;
}*/
int main()
{
    int n,i,ans=0;
    string s;
    map<char,int> m;
    cin>>n;
    cin>>s;
    i=0;
    while(i<n)
    {
        if(m.count(s[i])==0)
        {
            m[s[i]]=1;
        }
        else{
            m[s[i]]++;
        }
        i++;
    }
    for(auto itr=m.begin();itr!=m.end();++itr)
    {
        ans+=itr->second-1;
    }
    if(ans>26-(n-ans))ans=-1;
    cout<<ans;
    return 0;
}