main=do
 n<-readLn;s<-getLine
 print(sum[f n s x y z|x<-"0123456789",y<-"0123456789",z<-"0123456789"])
  where f 0 _ _ _ _ = 0
        f n s 'a' 'a' z = if (head s)==z then 1 else (f (n-1) (tail s) 'a' 'a' z)
        f n s 'a' y z = f (n-1) (tail s) 'a' (if (head s)==y then 'a' else y) z
        f n s x y z = f (n-1) (tail s) (if (head s)==x then 'a' else x) y z