unittest
{
	assert( [ "2", "1 2", "2 3" ].parse.expand.solve == 3 );
	assert( [ "3", "100 100", "10 10000", "1 1000000000" ].parse.expand.solve == 9991 );
}



import std.algorithm;
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 );
	auto as = new long[ n ];
	auto bs = new long[ n ];
	foreach( ref a, ref b; lockstep( as, bs ) )
	{
		input.popFront;
		auto ab = input.front.split.to!( long[] );
		a = ab[ 0 ];
		b = ab[ 1 ];
	}
	return tuple( as, bs );
}

auto solve( long[] as, long[] bs )
{
	as.sort();
	bs.sort();
	
	// 最小値配列の中央値から最大値配列の中央値までの範囲が答えになる
	auto ans = 0L;
	if( as.length % 2 == 0 ) ans = 1 + ( bs[ $ / 2 - 1 ] + bs[ $ / 2 ] ) - ( as[ $ / 2 - 1 ] + as[ $ / 2 ] );
	else                     ans = 1 + bs[ $ / 2 ] - as[ $ / 2 ];
	return ans;
}
