unittest
{
	assert( [ "4" ].parse.expand.solve == 1 );
	assert( [ "999999" ].parse.expand.solve == 499999 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	return tuple( n );
}

auto solve( long n )
{
	return n / 2 - ( n % 2 == 0 );
}
