#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main() {
	map<string, int> f;
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		f[s]++;
	}
	int M;
	cin >> M;
	for (int i = 0; i < M; i++) {
		string s;
		cin >> s;
		f[s]--;
	}

	int ans = 0;
	for (auto x : f) ans = max(ans, x.second);
	cout << ans << endl;
}