405950: GYM102191 A Generous Eater
Memory Limit:256 MB
Time Limit:0 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
A. Generous Eatertime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output
You have n candies. You want to give as much to your friends as possible, but you have a problem; every time you give two friends a candy each, you can't help but eat one yourself (if you have one left). You tried to resist after giving the first one, but after giving the second, it was unbearable.
What is the maximum number of friends you can give candies to?
InputThe first line of input contains n (1 ≤ n ≤ 109), the number of candies you have.
OutputOutput a single line with the maximum number of friends you can give candies to.
ExamplesInput4Output
3Input
5Output
4Input
6Output
4