#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int N;
long long A[200000];
long long B[200000];
int main(){
  long long n1;
  long long n2;
  long long cnt;
  long long mn1;
  long long mn2;
  long long mx1;
  long long mx2;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
      rd(B[Lj4PdHRW]);
    }
  }
  if(N%2==0){
    int i;
    for(i=(0);i<(N);i++){
      {
        auto RZTsC2BF = (2);
        A[i] *= RZTsC2BF;
        B[i] *= RZTsC2BF;
      }
    }
  }
  n1 = (N+1) / 2;
  n2 = (N+2) / 2;
  long long FmcKpFmN;
  long long xr20shxY;
  long long WYIGIcGE;
  FmcKpFmN = -1;
  xr20shxY = 10000000000LL;
  while(FmcKpFmN < xr20shxY){
    int i;
    if((FmcKpFmN + xr20shxY)%2==0){
      WYIGIcGE = (FmcKpFmN + xr20shxY) / 2;
    }
    else{
      WYIGIcGE = (FmcKpFmN + xr20shxY - 1) / 2;
    }
    cnt = 0;
    for(i=(0);i<(N);i++){
      if(A[i] <= WYIGIcGE){
        cnt++;
      }
    }
    if(cnt >= n1){
      xr20shxY = WYIGIcGE;
    }
    else{
      FmcKpFmN = WYIGIcGE + 1;
    }
  }
  mn1 =xr20shxY;
  long long a2conNHc;
  long long hCmBdyQB;
  long long V9aVTaxx;
  a2conNHc = -1;
  hCmBdyQB = 10000000000LL;
  while(a2conNHc < hCmBdyQB){
    int i;
    if((a2conNHc + hCmBdyQB)%2==0){
      V9aVTaxx = (a2conNHc + hCmBdyQB) / 2;
    }
    else{
      V9aVTaxx = (a2conNHc + hCmBdyQB + 1) / 2;
    }
    cnt = 0;
    for(i=(0);i<(N);i++){
      if(B[i] >= V9aVTaxx){
        cnt++;
      }
    }
    if(cnt >= n1){
      a2conNHc = V9aVTaxx;
    }
    else{
      hCmBdyQB = V9aVTaxx - 1;
    }
  }
  mx1 =hCmBdyQB;
  long long ZIeRIny5;
  long long iMWUTgY_;
  long long AlM5nNnR;
  ZIeRIny5 = -1;
  iMWUTgY_ = 10000000000LL;
  while(ZIeRIny5 < iMWUTgY_){
    int i;
    if((ZIeRIny5 + iMWUTgY_)%2==0){
      AlM5nNnR = (ZIeRIny5 + iMWUTgY_) / 2;
    }
    else{
      AlM5nNnR = (ZIeRIny5 + iMWUTgY_ - 1) / 2;
    }
    cnt = 0;
    for(i=(0);i<(N);i++){
      if(A[i] <= AlM5nNnR){
        cnt++;
      }
    }
    if(cnt >= n2){
      iMWUTgY_ = AlM5nNnR;
    }
    else{
      ZIeRIny5 = AlM5nNnR + 1;
    }
  }
  mn2 =iMWUTgY_;
  long long GgkpftXM;
  long long gEg5UqEA;
  long long qSsg05KM;
  GgkpftXM = -1;
  gEg5UqEA = 10000000000LL;
  while(GgkpftXM < gEg5UqEA){
    int i;
    if((GgkpftXM + gEg5UqEA)%2==0){
      qSsg05KM = (GgkpftXM + gEg5UqEA) / 2;
    }
    else{
      qSsg05KM = (GgkpftXM + gEg5UqEA + 1) / 2;
    }
    cnt = 0;
    for(i=(0);i<(N);i++){
      if(B[i] >= qSsg05KM){
        cnt++;
      }
    }
    if(cnt >= n2){
      GgkpftXM = qSsg05KM;
    }
    else{
      gEg5UqEA = qSsg05KM - 1;
    }
  }
  mx2 =gEg5UqEA;
  if(N%2==1){
    wt_L(mx1 - mn1 + 1);
    wt_L('\n');
  }
  else{
    wt_L((mx1+mx2)/2 - (mn1+mn2)/2 + 1);
    wt_L('\n');
  }
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// int N;
// ll A[2d5], B[2d5];
// {
//   ll n1, n2, cnt;
//   ll mn1, mn2, mx1, mx2;
//   rd(N,(A,B)(N));
//   if(N%2==0) rep(i,N) (A[i], B[i]) *= 2;
// 
//   n1 = (N+1) / 2;
//   n2 = (N+2) / 2;
// 
//   mn1 = bsearch_min[ll,x,-1,1d10][
//     cnt = 0;
//     rep(i,N) if(A[i] <= x) cnt++;
//   ](cnt >= n1);
// 
//   mx1 = bsearch_max[ll,x,-1,1d10][
//     cnt = 0;
//     rep(i,N) if(B[i] >= x) cnt++;
//   ](cnt >= n1);
// 
//   mn2 = bsearch_min[ll,x,-1,1d10][
//     cnt = 0;
//     rep(i,N) if(A[i] <= x) cnt++;
//   ](cnt >= n2);
// 
//   mx2 = bsearch_max[ll,x,-1,1d10][
//     cnt = 0;
//     rep(i,N) if(B[i] >= x) cnt++;
//   ](cnt >= n2);
// 
// //  wt(mn1,mn2,mx1,mx2);
// 
//   if(N%2==1){
//     wt(mx1 - mn1 + 1);
//   } else {
//     wt((mx1+mx2)/2 - (mn1+mn2)/2 + 1);
//   }
// }


Measured memory_bytes: 7744