import java.util.*;
import java.lang.*;
import java.io.*;

class Main {
	static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	static PrintWriter out = new PrintWriter(System.out);
	static int nextInt() throws IOException  {
		in.nextToken();
		return (int) in.nval;
	}
	public static void main (String[] args) throws java.lang.Exception {
		Scanner in = new Scanner(System.in);
		int n = nextInt(), j = 0;
		for (int i = n; i > 0; i--) {
			int a = nextInt(), b = nextInt();
			if (b != a - 1) j++;
		}
		out.println(j);
		out.flush();
	}
}