program prob4
    implicit none
    integer::N, i, j, ans, tmp, k
    character(len=30005)::S
    character(len=3)::t
    read(*,*) N
    read(*,*) S

    ans = 0
    do i = 0, 999
        k = 2
        tmp = i
        do j = 1, N
            if(S(j:j) .eq. char(ichar('0') + tmp/10**k)) then
                tmp = tmp - tmp/10**k*10**k
                k = k-1
            end if
            if(k == -1) then
                ans = ans + 1
                exit
            end if
        end do
    end do
    write(*,*) ans

    stop
end program