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 Perl (v5.18.2) (judge verdict: Wrong Answer)

use bigint;
my $fac = 998244353;
my $N = <STDIN>;
chomp($N);
my $T;
my $i = 0;
foreach my $d (map {$_ + 0} split(/ /o, <STDIN>)){
    $T->{$d} = 0 unless (defined($T->{$d}));
    $T->{$d}++;
    if ($i == 0 and $d != 0) {
      print 0;
      exit 0;
    }
    $i++;
}
if ( !defined($T->{0}) or $T->{0} != 1) {
    print 0;
    exit 0;
}
$i = 0;
my $ans = 1;
my $last = 1;
foreach my $j (sort {$a <=> $b} keys %{$T}) {
    my $val = $T->{$j};
    if ( $i != $j ) {
        print 0;
        exit 0;
    }
    if ( $i == 0 ) {
    } else {
        my $v = &modpower($last, $val);
        $ans = ($ans * $v) % $fac;
    }
    $last = $T->{$j};
    $i++;
}
print $ans;
sub modpower($$) {
    my ($a, $n) = @_;
    my $res = 1;
    while ($n > 0) {
        $res = $res * $a % $fac if ($n & 1);
        $a = $a * $a % $fac;
        $n >>= 1;
    }
    return $res;
}