牛客557200294号:public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Set<Integer> set = new HashSet<>();
while (scanner.hasNextLine()) {
String s = scanner.nextLine();
String[] s1 = s.split(" ");
Integer a = Integer.valueOf(s1[0]);
Integer b = Integer.valueOf(s1[1]);
for (int i = a+1; i <= b; i++) {
set.add(i);
}
}
System.out.println(set.size());
}
}