inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
N = inp.shift() * 1
S = inp.shift()
cnt = 0
for(i=0;i<10;i++) {
    k = 0;
    while(S[k] != i) {
        k++
        if (k >= N) {
            break;
        }
    }
    k++
    for(j=0;j<10;j++) {
        l = k
        while(S[l] != j) {
            l++
            if (l >= N) {
                break;
            }
        }
        l++
        a = [0,0,0,0,0,0,0,0,0,0]
        c = 0
        while(l < N) {
            if (!a[S[l]]) {
                a[S[l]] = 1
                c++
                if (c == 10) {
                    break;
                }
            }
            l++
        }
        cnt += c
    }
}

console.log(cnt)