(ns Atcoder.ABC091-B)

(def N (read-string (read-line)))
(def ms (loop [m {} s [] i 0]
           (if (= i N)
             [m s]
             (do
               (def input (read-line))
               (if (nil? (get m (keyword input)))
                 (recur (conj m {(keyword input) 1}) (conj s input) (inc i))
                 (recur (update m (keyword input) + 1) s (inc i)))))))

(def M (read-string (read-line)))
(def mms (loop [m {} prem (first ms) s (second ms) i 0]
           (if (= i M)
             [prem m s]
             (do
               (def input (read-line))
               (if (nil? (get m (keyword input)))
                 (if (nil? (get prem (keyword input)))
                   (recur (conj m {(keyword input) 1}) (conj prem {(keyword input) 0}) (conj s input) (inc i))
                   (recur (conj m {(keyword input) 1}) prem s (inc i)))
                 (recur (update m (keyword input) + 1) prem s (inc i)))))))

; (println mms)
(def m1 (first mms))
(def m2 (second mms))
(def s (nth mms 2))

(println (reduce max (map #(- (if (nil? (get m1 (keyword %))) 0 (get m1 (keyword %)))
                              (if (nil? (get m2 (keyword %))) 0 (get m2 (keyword %)))) s)))