#P6861. Maximum Sum of Bitwise OR and XOR

    ID: 20068 Type: Default 1000ms 256MiB

Maximum Sum of Bitwise OR and XOR

Maximum Sum of Bitwise OR and XOR

Given a positive integer n, choose two integers a and b (1 ≤ a, b ≤ n) such that the expression \[ (a \; \mathrm{or}\; b) + (a \; \mathrm{xor}\; b) \] is maximized. Here, \(\mathrm{or}\) denotes the bitwise OR operator and \(\mathrm{xor}\) denotes the bitwise XOR operator.

The task is to compute and output the maximum possible value of this expression.

inputFormat

The input consists of a single integer n (1 ≤ n).

outputFormat

Output a single integer, which is the maximum value of the expression.

sample

1
1