import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int[string] s, t;

    int n = readint;
    for (int i = 0; i < n; i++) {
        string a = readln.chomp;
        s[a]++;
    }

    int m = readint;
    for (int i = 0; i < m; i++) {
        string a = readln.chomp;
        t[a]++;
    }

    int ans = 0;
    foreach (k, v; s) {
        ans = max(ans, max(0, v - t.get(k, 0)));
    }
    writeln(ans);
}
