\problem{Painting the Floodwall}


The town of South Riverside has a long floodwall to protect the
residents against occasional rising waters from the nearby Little
Muddy river.  It's very functional, but also a bit of an eyesore.

The town has decided to spruce it up by staging a competition for
local artists to paint murals on sections of the wall. Artists have
submitted applications for the contest, in which they have specified
not only how long a section of wall they want to paint but also, based
upon the surrounding scenery, where along the wall they would like to
place their mural.

Obviously, the artists' work cannot overlap, so there is a possibility
that not all artists' applications can be accepted. On the other hand,
the town would like to see as much of the wall painted as possible.

Find the combination of artists whose applications can be accepted to
maximize the amount of the wall painted without allowing any artists'
work to overlap.  A mural that starts at the same coordinate at which
another mural stops is not considered to overlap.


\subsection*{Input}

Input will begin with a line containing an integer $N$ denoting the
number of artists whose have submitted applications.   $1 \leq N \leq
\num{200000}$

This will be followed by $N$ lines, each containing two integers $x_0$
and $x_1$, $0 \leq x_0 \leq x_1 \leq 10^{18}$, denoting a starting and
ending position (inclusive) for a proposed mural.

\subsection*{Output}

Print a single line containing the maximum total length of the fence
that can be painted without allowing any two artists' work to overlap.


\subsection*{Example}

\begin{center}
  \begin{tabular}{|p{0.45\linewidth}|p{0.45\linewidth}|}
    \multicolumn{1}{l}{\textbf{Sample Input}} &
    \multicolumn{1}{l}{\textbf{Sample Output}} \\
    \hline
3 & 200 \\
100 200 & \\
190 210 & \\
200 300 & \\
\hline
5 & 13 \\
0 5 & \\
12 18  & \\
4 14  & \\
7 9  & \\
17 18  & \\ \hline
\end{tabular}
\end{center}

The second example reflects a decision to accept the applications to paint
portions $0 \ldots 5$, $7 \ldots 9$, and $12 \ldots 18$.
