Problem:
Score : 100 points

Problem Statement

How many ways are there to choose two distinct positive integers totaling N, disregarding the order?

Constraints

1 \leq N \leq 10^6

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer.

Sample Input 1

4

Sample Output 1

1

There is only one way to choose two distinct integers totaling 4: to choose 1 and 3. (Choosing 3 and 1 is not considered different from this.)

Sample Input 2

999999

Sample Output 2

499999

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;

class test{
  static void Main(){
	Int64 n = Int64.Parse(Console.ReadLine());
	string[] a = Console.ReadLine().Split();
    string[] b = Console.ReadLine().Split();
    Int64 replacecnt=0;
    bool no_flg = false;
    for(Int64 cntb=0;cntb<b.Length;cntb++){
      if(Int64.Parse(a[cntb])==Int64.Parse(b[cntb])){
         break; 
      }else{
        Int64 smallest=0;
        Int64 cntb_tmp=cntb;
        Int64 cnta=0;
      	for(;cnta<a.Length;cnta++){
          if(Int64.Parse(a[cnta])==Int64.Parse(b[cntb]) && cnta != cntb){
            if(cnta<cntb){
              if(Int64.Parse(a[cntb])<=Int64.Parse(b[cnta])){
                string tmp =  a[cnta];
                a[cnta] = a[cntb];
                a[cntb] = tmp;
                replacecnt += 1;
                break;
              }
            }else{
                string tmp =  a[cnta];
                a[cnta] = a[cntb];
                a[cntb] = tmp;
                replacecnt += 1;
                break;
            }
          }else{
            if(cnta < cntb){
              if(smallest == 0 || Int64.Parse(a[cnta])<Int64.Parse(a[smallest])){
                smallest = cnta;
              }
            }
          }
        }
        if(Int64.Parse(b[cntb]) < Int64.Parse(a[smallest])){
          no_flg=true;
          break;
        }else{
          string tmp =  a[smallest];
          a[smallest] = a[cntb];
          a[cntb] = tmp;
          replacecnt += 1;
        }
      }
    }
    if(replacecnt <= (n-2) && no_flg == false){
      Console.Write("Yes");
    }else{
      Console.Write("No");
    }
  }
}