## USACO 2015 December Contest, Bronze

## Problem 1. Fence Painting

Contest has ended.

**Log in to allow submissions in analysis mode**

If we regard the fence as a one-dimensional number line, Farmer John paints the interval between $x=a$ and $x=b$. For example, if $a=3$ and $b=5$, then Farmer John paints an interval of length 2. Bessie, misunderstanding Farmer John's instructions, paints the interval from $x=c$ to $x=d$, which may possibly overlap with part or all of Farmer John's interval. Please determine the total length of fence that is now covered with paint.

#### INPUT FORMAT (file paint.in):

The first line of the input contains the integers $a$ and $b$, separated by a space ($a < b$).The second line contains integers $c$ and $d$, separated by a space ($c < d$).

The values of $a$, $b$, $c$, and $d$ all lie in the range $0 \ldots 100$, inclusive.

#### OUTPUT FORMAT (file paint.out):

Please output a single line containing the total length of the fence covered with paint.#### SAMPLE INPUT:

7 10 4 8

#### SAMPLE OUTPUT:

6

Here, 6 total units of fence are covered with paint, from $x=4$ all the way through $x=10$.

Problem credits: Brian Dean