gets;
s = gets.chomp;
t = [];
ans = 0;

[*'0'..'9'].each do |i|
  [*'0'..'9'].each do |j|
    [*'0'..'9'].each do |k|
      t << [i,j,k];
    end
  end
end

t.each do |v|
  x = s.index(v[0], 0);
  y = s.index(v[1], x + 1) if x;
  z = s.index(v[2], y + 1) if y;

  ans += 1 if x && y && z;
end

puts ans;
