There are N integers X_1, X_2, \cdots, X_N, and we know that A_i \leq X_i \leq B_i. Find the number of different values that the median of X_1, X_2, \cdots, X_N can take.

Constraints

* 2 \leq N \leq 2 \times 10^5
* 1 \leq A_i \leq B_i \leq 10^9
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N
A_1 B_1
A_2 B_2
:
A_N B_N


Output

Print the answer.

Examples

Input

2
1 2
2 3


Output

3


Input

3
100 100
10 10000
1 1000000000


Output

9991

import java.io.*;
import java.util.*;

public class Main {
    private static final boolean N_CASE = false;
    private static final int MAX = 1000000005;

    private int bs1(List<Integer> a, int x) {
        int left = 0, right = a.size() - 1;
        while (left <= right) {
            int mid = (left + right) / 2;
            if (a.get(mid) > x) {
                right = mid - 1;
            } else {
                left = mid + 1;
            }
        }
        return right;
    }

    private int bs2(List<Integer> a, int x) {
        int left = 0, right = a.size() - 1;
        while (left <= right) {
            int mid = (left + right) / 2;
            if (a.get(mid) >= x) {
                right = mid - 1;
            } else {
                left = mid + 1;
            }
        }
        return left;
    }

    private void solve() {
        int N = sc.nextInt();

        List<Integer> A = new ArrayList<>();
        List<Integer> B = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(sc.nextInt());
            B.add(sc.nextInt());
        }

        List<Integer> s = new ArrayList<>();
        s.addAll(A);
        s.addAll(B);

        Collections.sort(s);
        Collections.sort(A);
        Collections.sort(B);

        int M = (N + 1) / 2;

   //     System.out.println(l1 + " " + l2 + " " + u1 + " " + u2);
        if (N % 2 == 0) {
            int l = 0, r = 0;
            for(int i = 0; i < s.size(); ++i) {
                if (i > 0 && s.get(i).equals(s.get(i - 1))) {
                    continue;
                }

                int c1 = bs1(A, s.get(i)) + 1;
                int c2 = N - bs2(B, s.get(i));

          //      System.out.println(c1 + " " + c2);

                if (c1 >= M && c2 >= M + 1) {
                    l += l == 0 ? 1 : s.get(i) - s.get(i - 1);
                }

                if (c1 >= M + 1 && c2 >= M) {
                    r += r == 0 ? 1 : s.get(i) - s.get(i - 1);
                }
            }
//            System.out.println(M);
//            System.out.println(l + " " + r);
            out.println(l + r - 1);
        } else {
            int ans = 0;
            for (int i = 0; i < s.size(); ++i) {
                if (i > 0 && s.get(i).equals(s.get(i - 1))) {
                    continue;
                }

                int c1 = bs1(A, s.get(i)) + 1;
                int c2 = N - bs2(B, s.get(i));

                if (c1 >= M && c2 >= M) {
                    ans += ans == 0 ? 1 : s.get(i) - s.get(i - 1);
                }
            }
            out.println(ans);
        }
    }

    private void run() {
        int T = N_CASE ? sc.nextInt() : 1;
        for (int t = 0; t < T; ++t) {
            solve();
        }
    }

    private static MyWriter out;
    private static MyScanner sc;

    private static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        private MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        int[] nextArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        List<Integer> nextList(int n) {
            List<Integer> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                list.add(nextInt());
            }
            return list;
        }
    }

    private static class MyWriter extends PrintWriter {
        private MyWriter(OutputStream outputStream) {
            super(outputStream);
        }

        void printArray(int[] a) {
            for (int i = 0; i < a.length; ++i) {
                print(a[i]);
                print(i == a.length - 1 ? '\n' : ' ');
            }
        }

        void printlnArray(int[] a) {
            for (int v : a) {
                println(v);
            }
        }

        void printList(List<Integer> list) {
            for (int i = 0; i < list.size(); ++i) {
                print(list.get(i));
                print(i == list.size() - 1 ? '\n' : ' ');
            }
        }

        void printlnList(List<Integer> list) {
            list.forEach(this::println);
        }
    }

    public static void main(String[] args) {
        out = new MyWriter(new BufferedOutputStream(System.out));
        sc = new MyScanner();
        new Main().run();
        out.close();
    }
}