n=int(input()) list=[31,29,31,30,31,30,31,31,30,31,30,31] if n>=1 and n<=12: print(list[n-1]) else: print("Invalid.")