n = gets.to_i
s = gets.chop
count = 0

("0".."9").each{ |i|
    id = 0
    id += 1 until s[id] == i or id == s.size - 1
    next if id == s.size - 1
    ("0".."9").each{ |j|
        id1 = id + 1
        id1 += 1 until s[id1] == j or id1 == s.size - 1
        next if id1 == s.size - 1
        ("0".."9").each{ |k|
            id2 = id1 + 1
            id2 += 1 until s[id2] == k or id2 == s.size - 1
            count += 1 if s[id2] == k
        }
    }
}
puts count