import java.math.* ;
import java.util.* ;
class BigNumbers
{
public static void main
( String args
[ ] ) {
Scanner sc
= new Scanner
( System .
in ) ;
int n, A;
char [ ] s;
int [ ] pi, cnt;
int [ ] [ ] classes;
A= sc.nextInt ( ) ;
str = sc.nextLine ( ) ;
str = sc.nextLine ( ) ;
n= str.length ( ) ;
classes= new int [ A+ 1 ] [ ] ;
cnt= new int [ A+ 1 ] ;
for ( int i= 1 ; i<= A; i++ ) cnt[ i] = 0 ;
pi= new int [ n] ;
s= new char [ n] ;
for ( int i= 0 ; i< n; i++ )
{
s[ i] = str.charAt ( i) ;
cnt[ ( int ) s[ i] - ( int ) 'a' + 1 ] ++;
if ( i== 0 ) pi[ 0 ] = 0 ;
else
{
int j = pi[ i- 1 ] ;
while ( j > 0 && s[ i] != s[ j] ) j = pi[ j- 1 ] ;
if ( s[ i] == s[ j] ) j++;
pi[ i] = j;
}
}
for ( int i= 1 ; i<= A; i++ )
{
if ( cnt[ i] > 0 ) classes[ i] = new int [ cnt[ i] ] ;
cnt[ i] = 0 ;
}
for ( int i= 0 ; i< n; i++ )
{
int cl= ( int ) s[ i] - ( int ) 'a' + 1 ;
classes[ cl] [ cnt[ cl] ] = i+ 1 ;
cnt[ cl] ++;
}
for ( int i= 0 ; i< n; i++ )
{
for ( int k= 1 ; k<= A; k++ )
{
char x= ( char ) ( k- 1 + 'a' ) ;
if ( x== s[ i] ) continue ;
int j= 0 , L, R, m;
if ( classes[ k] != null )
{
L= 0 ;
R= cnt[ k] - 1 ;
while ( R- L> 1 )
{
m= ( L+ R) / 2 ;
if ( classes[ k] [ m] <= pi[ i] + 1 ) L= m;
else R= m;
}
if ( classes[ k] [ L] <= pi[ i] + 1 ) j= classes[ k] [ L] ;
if ( classes[ k] [ R] <= pi[ i] + 1 ) j= classes[ k] [ R] ;
}
a[ i+ 1 ] = a[ i+ 1 ] .subtract ( a[ j] ) ;
b[ i+ 1 ] = b[ i+ 1 ] .subtract ( b[ j] ) ;
}
}
ans
= BigInteger .
valueOf ( - 1 ) .
multiply ( b
[ n
] ) .
divide ( a
[ n
] ) ; System .
out .
println ( ans.
toString ( ) ) ; }
}
aW1wb3J0IGphdmEubWF0aC4qOwppbXBvcnQgamF2YS51dGlsLio7CgpjbGFzcyBCaWdOdW1iZXJzIAp7CiBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmcgYXJnc1tdKQogewogIFNjYW5uZXIgc2M9bmV3IFNjYW5uZXIoU3lzdGVtLmluKTsgCiAKICBpbnQgbiwgQTsKICBTdHJpbmcgc3RyOwogIGNoYXJbXSBzOwogIGludFtdIHBpLCBjbnQ7CiAgQmlnSW50ZWdlcltdIGEsIGI7CiAgQmlnSW50ZWdlciBhbnM7CiAgaW50W11bXSBjbGFzc2VzOwogIAogIEE9c2MubmV4dEludCgpOwogIHN0ciA9IHNjLm5leHRMaW5lKCk7CiAgc3RyID0gc2MubmV4dExpbmUoKTsKICAKICBuPXN0ci5sZW5ndGgoKTsKICAKICBjbGFzc2VzPW5ldyBpbnRbQSsxXVtdOwogIGNudD1uZXcgaW50W0ErMV07CiAgZm9yKGludCBpPTE7aTw9QTtpKyspIGNudFtpXT0wOwogIAogIHBpPW5ldyBpbnRbbl07CiAgcz1uZXcgY2hhcltuXTsKICAKICBmb3IoaW50IGk9MDtpPG47aSsrKQogIHsKICAgICBzW2ldPXN0ci5jaGFyQXQoaSk7CiAgICAgY250WyhpbnQpc1tpXS0oaW50KSdhJysxXSsrOwogICAgIGlmKGk9PTApIHBpWzBdPTA7CiAgICAgZWxzZQogICAgIHsKICAgICAgICBpbnQgaiA9IHBpW2ktMV07CgkJICB3aGlsZShqID4gMCAmJiBzW2ldICE9IHNbal0pIGogPSBwaVtqLTFdOwoJCSAgaWYgKHNbaV0gPT0gc1tqXSkgIGorKzsKCQkgIHBpW2ldID0gajsKICAgICB9CiAgfQogIAogIGZvcihpbnQgaT0xO2k8PUE7aSsrKQogIHsKICAgICBpZihjbnRbaV0+MCkgY2xhc3Nlc1tpXT1uZXcgaW50W2NudFtpXV07CiAgICAgY250W2ldPTA7CiAgfQogIAogIAogIGZvcihpbnQgaT0wO2k8bjtpKyspCiAgewogICAgIGludCBjbD0oaW50KXNbaV0tKGludCknYScrMTsKICAgICBjbGFzc2VzW2NsXVtjbnRbY2xdXT1pKzE7CiAgICAgY250W2NsXSsrOwogIH0KICAKICBhPW5ldyBCaWdJbnRlZ2VyW24rMV07CiAgYj1uZXcgQmlnSW50ZWdlcltuKzFdOwogIAogIGFbMF09QmlnSW50ZWdlci5PTkU7CiAgYlswXT1CaWdJbnRlZ2VyLlpFUk87CiAgCiAgCiAgZm9yKGludCBpPTA7IGk8bjsgaSsrKSAKICB7CiAgICAgIGFbaSsxXT1hW2ldLm11bHRpcGx5KEJpZ0ludGVnZXIudmFsdWVPZihBKSk7CiAgICAgIGJbaSsxXT1iW2ldLm11bHRpcGx5KEJpZ0ludGVnZXIudmFsdWVPZihBKSkuc3VidHJhY3QoQmlnSW50ZWdlci52YWx1ZU9mKEEpKTsKICAgICAgZm9yKGludCBrPTE7azw9QTtrKyspCiAgICAgIHsKICAgICAgICAgY2hhciB4PShjaGFyKShrLTEgKyAnYScpOwogICAgICAgICBpZih4PT1zW2ldKSBjb250aW51ZTsKICAgICAgICAgaW50IGo9MCwgTCwgUiwgbTsKICAgICAgICAgaWYoY2xhc3Nlc1trXSE9bnVsbCkKICAgICAgICAgewogICAgICAgICAgICBMPTA7CiAgICAgICAgICAgIFI9Y250W2tdLTE7CiAgICAgICAgICAgIHdoaWxlKFItTD4xKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgIG09KEwrUikvMjsKICAgICAgICAgICAgICAgaWYoY2xhc3Nlc1trXVttXTw9cGlbaV0rMSkgTD1tOwogICAgICAgICAgICAgICBlbHNlIFI9bTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpZihjbGFzc2VzW2tdW0xdPD1waVtpXSsxKSBqPWNsYXNzZXNba11bTF07CiAgICAgICAgICAgIGlmKGNsYXNzZXNba11bUl08PXBpW2ldKzEpIGo9Y2xhc3Nlc1trXVtSXTsKICAgICAgICAgfQoJCSAgIGFbaSsxXT1hW2krMV0uc3VidHJhY3QoYVtqXSk7CgkJICAgYltpKzFdPWJbaSsxXS5zdWJ0cmFjdChiW2pdKTsKICAgICAgfQoJfQoJCiAgIGFucz1CaWdJbnRlZ2VyLnZhbHVlT2YoLTEpLm11bHRpcGx5KGJbbl0pLmRpdmlkZShhW25dKTsKICAgU3lzdGVtLm91dC5wcmludGxuKGFucy50b1N0cmluZygpKTsKIH0KfQ==