cho.sh
Notes
Loading...

Circular Dance

Time limit

2s

Memory limit

128 MB

Problem

N people stand in a circle, holding hands in the order 1, 2, ..., N. In one swap, only two people who are currently adjacent in the circle may exchange places, and the people remain arranged in a circle after the swap.

The goal is to make the circular order exactly opposite to the initial order. Because the arrangement is circular, rotations of the same order are considered identical.

Find the minimum number of swaps needed to reverse the order.

Input

The first line contains the number of people N (1 ≤ N ≤ 32767).

Output

Print the minimum number of swaps needed to reverse the order.