n= int(input()) w = 9 while n > 0: r = n % 10 if r < w: w = r if w == 0: break n = n // 10 print(w)
1