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;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder.Abc
{
    internal class QuestionB
    {
        public static void Main(string[] args)
        {
            // 整数の入力
            int n = int.Parse(Console.ReadLine());

            // 整数配列の入力
            var dArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i));

            if (dArray.ElementAt(0) != 0)
            {
                Console.WriteLine(0);
                return;
            }

            Dictionary<int, int> dic = new Dictionary<int, int>();

            int max = -1;
            foreach (var d in dArray)
            {
                if (dic.ContainsKey(d))
                {
                    dic[d]++;
                }
                else
                {
                    dic.Add(d, 1);
                }
                if (max < d)
                {
                    max = d;
                }
            }

            if (dic[0] != 1)
            {
                Console.WriteLine(0);
                return;
            }

            long result = 1;

            for (int i = 1; i <= max; i++)
            {
                if (dic.ContainsKey(i) == false)
                {
                    Console.WriteLine(0);
                    return;
                }

                result *= (long)Math.Pow(dic[i - 1], dic[i]);
                if (result > 998244353)
                {
                    result %= 998244353;
                }
            }

            Console.WriteLine(result %= 998244353);
        }
    }
}