// NOTE: it is recommended to use this even if you don't understand the following code.

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

public class pattern {

    public static void main(String[] args) throws FileNotFoundException, IOException {
        Locale.setDefault(Locale.US);
        InputStream fin = System.in;
        OutputStream fout = System.out;
        // uncomment the two following lines if you want to read/write from files
        // fin = new FileInputStream("input.txt");
        // fout = new FileOutputStream("output.txt");

        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fout));
        reader = new BufferedReader(new InputStreamReader(fin));
        scn = new StringTokenizer(reader.readLine());

        int S = Integer.parseInt(next());

        int[] X_1 = new int[S], Y_1 = new int[S], X_2 = new int[S], Y_2 = new int[S];
        for (int i = 0; i < S; ++i) {
            X_1[i] = Integer.parseInt(next());
            Y_1[i] = Integer.parseInt(next());
            X_2[i] = Integer.parseInt(next());
            Y_2[i] = Integer.parseInt(next());
        }

        int N = Integer.parseInt(next());

        int[] x1 = new int[N], y1 = new int[N], x2 = new int[N], y2 = new int[N];
        for (int i = 0; i < N; ++i) {
            x1[i] = Integer.parseInt(next());
            y1[i] = Integer.parseInt(next());
            x2[i] = Integer.parseInt(next());
            y2[i] = Integer.parseInt(next());
        }

        int ans = 0;


        // INSERT YOUR CODE HERE


        writer.write(String.valueOf(ans));
        writer.write('\n');

        writer.flush();
    }

    static String next() throws IOException {
        while (!scn.hasMoreTokens()) scn = new StringTokenizer(reader.readLine());
        return scn.nextToken();
    }

    static BufferedReader reader;
    static StringTokenizer scn;
}
