#include<stdio.h>
#include<string.h>
#include <stdlib.h>
int main(void){
    int N;
    char S[4001];
    scanf("%d",&N);
    scanf("%s",S);
    if (N<=3) {
        printf("0\n");
        return 0;
    }
    int long SUM=0,T=0;
    for (int i=0; i<N-2; i++) {
        for (int j=i+1; j<N-1; j++) {
            T+=(N-1)-j;
            if (S[i]==S[j]) {
                SUM+=(N-1)-j;
            }
            else{
                for (int l=j+1; l<N; l++) {
                    if (S[i]==S[l] || S[j]==S[l] || j-i==j-l) {
                        SUM++;
                    }
                }
            }
        }
    }
    printf("%ld\n",T-1-SUM);
    printf("%ld %ld\n",T,SUM);
    return 0;
}