M - Find Amir

A few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.

There are n schools numerated from 1 to n. One can travel between each pair of them, to do so, he needs to buy a ticket. The ticker between schools i and j costs ![在这里插入图片描述](https://vj.e949.cn/00f816db88e1ab24d695a8ca7bba2088?v=1543121283)and can be used multiple times. Help Sajjad to find the minimum cost he needs to pay for tickets to visit all schools. He can start and finish in any school.

Input

The first line contains a single integer n (1 ≤ n ≤ 105) — the number of schools.

Output

Print single integer: the minimum cost of tickets needed to visit all schools.

Examples
Input

2

Output

0

Input

10

Output

4

Note

In the first example we can buy a ticket between the schools that costs .![在这里插入图片描述](https://vj.e949.cn/cdf864b92f748661512f2652cd873738?v=1543121283)

这道题找下规律就好了,例如n=10;选择以下路线1->10->2->9->3->8->4->7->5->6
1->10 票价为零;10->2 票价为1;
如此类推可得最小票价为(n-1)/2;

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	printf("%d",(n-1)/2);
	return 0;
}

猜你喜欢

转载自blog.csdn.net/lemail0406/article/details/84486539