def p(n): return 0 if n==0 else p(n>>1)+(n&1) print(pow(2,p(int(input())))-2)