#include<iostream>

using namespace std;

int main(){

int n,y=1,i;
char x[3005];	
	
cin >> n;	
cin >> x;	
	
if(n<=26)
	cout << "0";
else{
	
	for(i=0;i<n-1;i++){

		if(x[i]==x[i+1]){
			y=2;
			break;
		}
	
	}
	
		cout << y;

}
	
	
	return 0;
}