



# 백준 #30224 (Lucky 7)
# 사용자의 입력 받기
user_input = int(input())
# 숫자에 7이 포함되어 있는지 확인
contains_seven = '7' in str(user_input)
# 숫자가 7로 나누어지는지 확인
divisible_by_seven = user_input % 7 == 0
# 조건에 따른 출력
if not contains_seven and not divisible_by_seven:
print(0)
elif not contains_seven and divisible_by_seven:
print(1)
elif contains_seven and not divisible_by_seven:
print(2)
else:
print(3)