fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Main {
  6. static PrintWriter out = new PrintWriter(System.out);
  7. static int nextInt() throws IOException {
  8. in.nextToken();
  9. return (int) in.nval;
  10. }
  11. public static void main (String[] args) throws java.lang.Exception {
  12. Scanner in = new Scanner(System.in);
  13. int n = nextInt(), j = 0;
  14. for (int i = n; i > 0; i--) {
  15. int a = nextInt(), b = nextInt();
  16. if (b != a - 1) j++;
  17. }
  18. out.println(j);
  19. out.flush();
  20. }
  21. }
Success #stdin #stdout 0.06s 2184192KB
stdin
5
2 1
2 2
1 2
1 1
2 1
stdout
3