      PROGRAM piyo
      IMPLICIT NONE
      integer(16) :: n
      character(:),allocatable :: s
      integer(16) :: l,c,r,ans,pos1,pos2,pos3
      character(1) :: ch(0:9)
      
      ch(:) = ['0','1','2','3','4','5','6','7','8','9']
      
      read*,n
      allocate( character(n) :: s )
      read*,s
      
      ans = 0
      do l = 0,9
        pos1 = index(s(1:n),ch(l))
        if(pos1==0.or.pos1==n) cycle
        do c = 0,9
          pos2 = index(s(pos1+1:n),ch(c) )
          if(pos2==0) cycle
          pos2 = pos2 + pos1
          if(pos2==n) cycle
          do r = 0,9
            pos3 = index(s(pos2+1:n),ch(r) )
            if(pos3==0)then
              cycle
            else
              ans = ans + 1
            end if
          end do
        end do
      end do
      
      print*,ans
      
      
      END PROGRAM