#!/usr/bin/env python3 import sys def main(): N = int(input()) ab = [] for _ in range(N): a, b = map(int, input().split()) ab.append((a, b)) M = int(input()) l = [0] * M for i in range(M): x, y = map(int, input().split()) for _, q in enumerate(ab): a, b = q if x <= a and y >= b: l[i] += 1 print(max(l)) return if __name__ == '__main__': main()