#coding: utf-8 ##yuki_276 def gcd(a, b): while b: a, b = b, a % b return a n=int(raw_input()) res=gcd((n*n+n)/2,(n*n+n*3)/2) print res