# yukicoder No.395 永遠の17歳 A = int(input()) # 7を含むので最低でも8進数 # 故に15歳未満は無理 # それ以外はA - 7で求められる print(A - 7 if A >= 15 else -1)