N = gets.to_i
S = gets.chomp

ans = 0
(?0..?9).each{|a|
  offset1 = S.index(a)
  next if offset1.nil?
  offset1 += 1
  (?0..?9).each{|b|
    offset2 = S.index(b, offset1)
    next if offset2.nil?
    offset2 += 1
    (?0..?9).each{|c|
      if S.index(c, offset2)
        ans += 1
      end
    }
  }
}
p ans