import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	
    public static void main(String args[]) throws Exception
    {
		int[] cnt=new int[105];
		
		int l1=sc.nextInt(),r1=sc.nextInt();
		
		for(int i=l1+1;i<=r1;i++)
		{
			cnt[i]++;
		}
		
		int l2=sc.nextInt(),r2=sc.nextInt(),res=0;
		
		for(int i=l2+1;i<=r2;i++)
		{
			if(cnt[i]>0)
			{
				res++;
			}
		}
		
		out.println(res);out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
} import java.io.*; io.* java import java.util.*; util.* java import java.math.*; math.* java import java.util.concurrent.*; concurrent.* java.util class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	
    public static void main(String args[]) throws Exception
    {
		int[] cnt=new int[105];
		
		int l1=sc.nextInt(),r1=sc.nextInt();
		
		for(int i=l1+1;i<=r1;i++)
		{
			cnt[i]++;
		}
		
		int l2=sc.nextInt(),r2=sc.nextInt(),res=0;
		
		for(int i=l2+1;i<=r2;i++)
		{
			if(cnt[i]>0)
			{
				res++;
			}
		}
		
		out.println(res);out.close();
    }
} Main static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) static FastScanner sc=new FastScanner(br); sc new FastScanner(br) static PrintWriter out=new PrintWriter(System.out); out new PrintWriter(System.out) static Random rnd=new Random(); rnd new Random() public static void main(String args[]) throws Exception
    {
		int[] cnt=new int[105];
		
		int l1=sc.nextInt(),r1=sc.nextInt();
		
		for(int i=l1+1;i<=r1;i++)
		{
			cnt[i]++;
		}
		
		int l2=sc.nextInt(),r2=sc.nextInt(),res=0;
		
		for(int i=l2+1;i<=r2;i++)
		{
			if(cnt[i]>0)
			{
				res++;
			}
		}
		
		out.println(res);out.close();
    } main {
		int[] cnt=new int[105];
		
		int l1=sc.nextInt(),r1=sc.nextInt();
		
		for(int i=l1+1;i<=r1;i++)
		{
			cnt[i]++;
		}
		
		int l2=sc.nextInt(),r2=sc.nextInt(),res=0;
		
		for(int i=l2+1;i<=r2;i++)
		{
			if(cnt[i]>0)
			{
				res++;
			}
		}
		
		out.println(res);out.close();
    } int[] cnt=new int[105]; cnt new int[105] 105 int l1=sc.nextInt() l1 sc.nextInt() sc.nextInt sc r1=sc.nextInt(); r1 sc.nextInt() sc.nextInt sc for(int i=l1+1;i<=r1;i++)
		{
			cnt[i]++;
		} int i=l1+1; int i=l1+1; i l1+1 l1 1 i<=r1 i r1 i++ i++ i {
			cnt[i]++;
		} {
			cnt[i]++;
		} cnt[i]++ cnt[i] cnt i int l2=sc.nextInt() l2 sc.nextInt() sc.nextInt sc r2=sc.nextInt() r2 sc.nextInt() sc.nextInt sc res=0; res 0 for(int i=l2+1;i<=r2;i++)
		{
			if(cnt[i]>0)
			{
				res++;
			}
		} int i=l2+1; int i=l2+1; i l2+1 l2 1 i<=r2 i r2 i++ i++ i {
			if(cnt[i]>0)
			{
				res++;
			}
		} {
			if(cnt[i]>0)
			{
				res++;
			}
		} if(cnt[i]>0)
			{
				res++;
			} cnt[i]>0 cnt[i] cnt i 0 {
				res++;
			} res++ res out.println(res) out.println out res out.close() out.close out String args[] args class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
} FastScanner BufferedReader in; in StringTokenizer st; st public FastScanner(BufferedReader in) {
        this.in = in;
    } FastScanner {
        this.in = in;
    } this.in = in this.in this this.in in BufferedReader in in public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    } nextToken {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    } while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        } st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
            st = new StringTokenizer(in.readLine());
        } st = new StringTokenizer(in.readLine()) st new StringTokenizer(in.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public String next() throws Exception {
		return nextToken().toString();
	} next {
		return nextToken().toString();
	} return nextToken().toString(); nextToken().toString() nextToken().toString nextToken() nextToken public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    } nextInt {
        return Integer.parseInt(nextToken());
    } return Integer.parseInt(nextToken()); Integer.parseInt(nextToken()) Integer.parseInt Integer nextToken() nextToken public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    } nextLong {
        return Long.parseLong(nextToken());
    } return Long.parseLong(nextToken()); Long.parseLong(nextToken()) Long.parseLong Long nextToken() nextToken public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    } nextDouble {
        return Double.parseDouble(nextToken());
    } return Double.parseDouble(nextToken()); Double.parseDouble(nextToken()) Double.parseDouble Double nextToken() nextToken
import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	
    public static void main(String args[]) throws Exception
    {
		int[] cnt=new int[105];
		
		int l1=sc.nextInt(),r1=sc.nextInt();
		
		for(int i=l1+1;i<=r1;i++)
		{
			cnt[i]++;
		}
		
		int l2=sc.nextInt(),r2=sc.nextInt(),res=0;
		
		for(int i=l2+1;i<=r2;i++)
		{
			if(cnt[i]>0)
			{
				res++;
			}
		}
		
		out.println(res);out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}