package algo; import java.util.Scanner; public class sample7 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A = sc.nextInt(); int B = sc.nextInt(); int C = sc.nextInt(); int D = sc.nextInt(); int cnt = 0; for(int i = A; i <= B; i++){ for(int j = C; j <= D; j++) { if(i != j) { cnt = cnt + 1; } else { } } } System.out.println(cnt); } }