local n = io.read("*n", "*l")
local s = io.read()
local t1, t2, t3 = {}, {}, {}
for i = 1, 10 do
  t1[i] = false
end
for i = 1, 100 do
  t2[i] = false
end
for i = 1, 1000 do
  t3[i] = false
end
for i = 1, n do
  local k = tonumber(s:sub(i, i))
  if k == 0 then k = 10 end
  for j = 1, 100 do
    if t2[j] then
      t3[(j - 1) * 10 + k] = true
    end
  end
  for j = 1, 10 do
    if t1[j] then
      t2[(j - 1) * 10 + k] = true
    end
  end
  t1[k] = true
end
local ret = 0
for i = 1, 1000 do
  if t3[i] then ret = ret + 1 end
end
print(ret)
