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

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define MAXS 50
#define MAXN 100000

int N, S, ans, i;
int X_1[MAXS], X_2[MAXS], Y_1[MAXS], Y_2[MAXS];
int x1[MAXN], x2[MAXN], y1[MAXN], y2[MAXN];

int main() {
    // uncomment the two following lines if you want to read/write from files
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    assert(1 == scanf("%d", &S));

    for (i = 0; i < S; ++i)
        assert(4 == scanf("%d%d%d%d", &X_1[i], &Y_1[i], &X_2[i], &Y_2[i]));

    assert(1 == scanf("%d", &N));

    for (i = 0; i < N; ++i)
        assert(4 == scanf("%d%d%d%d", &x1[i], &y1[i], &x2[i], &y2[i]));

    ans = 0;


    // INSERT YOUR CODE HERE


    printf("%d\n", ans);

    return 0;
}
