Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

A2. Collective Mindsets (medium)

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputWay to go! Heidi now knows how many brains there must be for her to get one. But throwing herself in the midst of a clutch of hungry zombies is quite a risky endeavor. Hence Heidi wonders: what is the smallest number of brains that must be in the chest for her to get out at all (possibly empty-handed, but alive)?

The brain dinner night will evolve just as in the previous subtask: the same crowd is present, the *N* - 1 zombies have the exact same mindset as before and Heidi is to make the first proposal, which must be accepted by at least half of the attendees for her to survive.

Input

The only line of input contains one integer: *N*, the number of attendees (1 ≤ *N* ≤ 10^{9}).

Output

Output one integer: the smallest number of brains in the chest which allows Heidi to merely survive.

Examples

Input

1

Output

0

Input

3

Output

1

Input

99

Output

49

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/14/2019 01:32:03 (e2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|