https://www.acmicpc.net/problem/1769
n = input() cnt = 0 while (len(n)>1): temp = 0 for i in n: temp += int(i) n = str(temp) cnt += 1 n = int(n) print(cnt) if n % 3 == 0 : print("YES") else: print("NO")