An Animal Contest 2 P0 - Koala Matchmaking

View as PDF

Submit solution


Points: 3
Time limit: 0.5s
Memory limit: 256M

Authors:
Problem type

Contrary to common belief, Koalas are very socially active. Ken Koala has been on many matchmaking sites, and is now interested in making his own matchmaking algorithm. Ken's algorithm takes in a koala's favourite number, N, and chooses an optimal integer X < N such that the average of N and X, denoted by A, is an integer and is maximal. The Koala with favourite number N will be matched with a Koala with favourite number A.

Given the inputted value of N, you are to find the value of the integer, A.

Constraints

3 \le N \le 2 \cdot 10^9

Input Specification

The input will contain an integer N.

Output Specification

Output the value of the integer A.

Sample Input

15

Sample Output

14

Explanation for Sample

The optimal X to choose is 13, resulting in an average of \frac{15+13}{2} = 14.


Comments

There are no comments at the moment.