#include <iostream>
#include <string>
using namespace std;

int main(int argc, char** argv) {
	int n;
	string a;
	cin>>n;
	cin>>a;
	int fl =0;
	
	if(n<=26){
		cout<<0;
	}
	else if(n=27){
		
		for(int i = 0; i<n; i++){
			
			if(a[i] == a[i+1]){
			
				fl=1;				
			}
		}		
		if(fl==1){
			
			cout<<2;	
		}
		else if(fl==0){
				
			cout<<1;
		}
	}
	else{
	
		cout<<3;
	}
	return 0;
}