fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. unsigned int n;
  6. cin >> n;
  7. unsigned int a, b, j = 0;
  8. for (n; n > 0; n--) {
  9. cin >> a >> b;
  10. if (b != a - 1) j++;
  11. }
  12. cout << j;
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 15240KB
stdin
5
2 1
2 2
1 2
1 1
2 1
stdout
3