#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

## Problem Description

In Potatoland, Jiahai the Ultimate Leader of the Potatoes is planning a massive celebration to celebrate the fifth anniversary of Jiahai Potato Farm (JPF), and he wants all the potatoes in his farm to be present for this important occasion.

However, there is a problem. The *N* potatoes in JPF are incredibly busy, and can each of them is only free during a certain period of time. In particular, potato *i* is only free from time A_{i} to time B_{i} (inclusive). Given all of these values, help Jiahai calculate the length of the longest party he could have where all the potatoes are free (therefore present).

## Input

The first line of input will contain one integer, *N*.

The next *N* lines of input will contain two integers each, with the *i*th line containing integers *A _{i}* and

*B*.

_{i}## Output

Your output should contain one integer, the length of the longest party Jiahai could have with all the potatoes free.

Your output should be terminated with a newline.

## Limits

Subtask 1 (17%): 1 ≤ N, A_{i}, B_{i} ≤ 1 000

Subtask 2 (25%): 1 ≤ N, A_{i}, B_{i} ≤ 1 000 000

Subtask 3 (58%): 1 ≤ N ≤ 1 000 000, 1 ≤ A_{i}, B_{i} ≤ 1 000 000 000

Subtask 4 (0%): As per sample testcases

## Sample Input 1

3 1 5 2 5 3 4

## Sample Output 1

2

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 17 | 20 | 2.5s | 32MB | Minimum |

2 | 25 | 20 | 2.5s | 32MB | Minimum |

3 | 58 | 20 | 2.5s | 32MB | Minimum |

4 | 0 | 1 | 2.5s | 32MB | Minimum |

### Judge Compile Command

g++-8 ans.cpp -o potatoparty -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512