n = input() count = 0 tempsum = 0 for i in range(len(n)): tempsum += int(n[i]) if tempsum % 3 == 0: count += 1 tempsum = 0 print(count)