246. Black & White
time limit per test: 0.25
sec.
memory limit per test: 65536
KB
input: standard
output: standard
Consider a necklace made of 2N1 black and white beads, K of which are black. Necklace is called "beautiful" if it is possible to choose two black beads (not necessarily different) in such a way that one of two necklace parts strictly between them contains exactly N beads.
For example, if N=4 and K=3, necklace "WBWBWBW" is beautiful, and necklace "BBWWBWW" is not.
You need to find minimal K for which every necklace of 2N1 beads is beatiful.
Input
The first line of input contains odd integer number 2N1 (5<=2N1<=2^311).
Output
Output minimal K for which every necklace of 2N1 beads is beatiful.
Sample test(s)
Input
Test #1
5
Test #2
7
Output
Test #1
3
Test #2
4
Author:  Alexey Preobrajensky

Resource:  Petrozavodsk Summer Training Sessions 2004

Date:  August 25, 2004

Server time: 20171123 19:46:42  Online Contester Team © 2002  2016. All rights reserved. 

