package main import . "fmt" func main() { var n int64 Scan(&n) a:=[]int64{} for c:=int64(1); c <= n; c = c*2 { if (n&c)==c { a=append(a, c) } } h:=(int64(1)< 0; c = c*2 { if (h&c) == c { ans |= a[0] } a=a[1:] } Println(ans) }