// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 100001
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
const double pi=acos(-1.0);

typedef pair<int, int> PII;

typedef vector<int> VI;

typedef vector<string> VS;

typedef vector<PII> VII;

typedef vector<VI> VVI;

typedef map<int,int> MPII;

typedef set<int> SETI;

typedef multiset<int> MSETI;

typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;

bool isPowerOfTwo (int x)
{
  /* First x in the below expression is
    for the case when x is 0 */
  return x && (!(x&(x-1)));
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
ll modInverse(ll n, ll p)
{
    return power(n, p-2, p);
}

// Returns nCr % p using Fermat's little
// theorem.
ll ncr(ll n, ll r,ll p)
{
   // Base case
   if (r==0)
      return 1;

    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    ll fac[n+1];
    fac[0] = 1;
    for (ll i=1 ; i<=n; i++)
        fac[i] = fac[i-1]*i%p;

    return (fac[n]* modInverse(fac[r], p) % p *
            modInverse(fac[n-r], p) % p) % p;
}
const int nm = 200002;

int n;
pair<ll, bool> a[2 * nm];
vector<int> v[max1];
pair<ll, ll> get(int k) {
	int o = 0, c = 0, cur = 0;
	ll x1 = -1, x2 = -1;
	for (int i = 1; i <= 2 * n; ++i) {
		if (!a[i].second) {
			o++;
			cur++;
		}
		if (o >= k && c < k && cur > 0) {
			if (x1 == -1) {
				x1 = a[i].first;
			}
			x2 = a[i].first;
		}
		if (a[i].second) {
			c++;
			cur--;
		}
	}
	return {x1, x2};
}
void dfs(int ans[],bool x[],int cnt[],int j,int c){
    x[j]=true;
  for(int i=0;i<v[j].size();i++){
        if(cnt[v[j][i]]>=c){ans[v[j][i]]=j;cnt[v[j][i]]=c;}
    if(x[v[j][i]]==false){
        ans[v[j][i]]=j;
        cnt[v[j][i]]=c;
        dfs(ans,x,cnt,v[j][i],c+1);
    }
  }
}
#define deg_to_rad(deg) (((deg) / 360) * 2 * PI)
int main() {
    fast();
    cin>>n;
	for (int i = 1; i <= n; ++i) {
	cin>>a[2 * i - 1].first;
	cin>>a[2 * i].first;
		a[2 * i - 1].second = 0;
		a[2 * i].second = 1;
	}
	sort(a + 1, a + 2 * n + 1);
	if (n & 1) {
		auto p = get(n / 2 + 1);
		cout << p.second - p.first + 1 << "\n";
		return 0;
	}
	auto p1 = get(n / 2), p2 = get(n / 2 + 1);
	cout << (p2.second + p1.second - p2.first - p1.first + 1) << "\n";
}





Measured memory_bytes: 12248