#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using namespace std;

int main(){
	int N, M;
	cin >> N;
	string s[N];
	rep(i,N) cin >> s[i];
	cin >> M;
	string t[M];
	rep(i,M) cin >> t[i];
	sort(s,s+N);
	int ans = 0;
	int u = 1;
	string c = s[0];
	for (int i=1; i<N; i++){
		if (s[i] == c) u++;
		else {
			int d = 0;
			rep(j,M) if (t[j] == c) d++;
			ans = max(ans, u-d);
			u = 1;
			c = s[i];
		}
		if (i == N-1) {
			int d = 0;
			rep(j,M) if (t[j] == c) d++;
			ans = max(ans, u-d);
		}
	}
	cout << ans << endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;


int main() {
  int N;
  cin >> N;
  
  string s;
  map<string, int> S;
  for (int i=0; i<N; i++) {
    cin >> s;
    if (S.count(s)) S.at(s) += 1;
    else S[s] = 1;
  }
  
  int M;
  cin >> M;
  for (int i=0; i<M; i++) {
    cin >> s;
    if (S.count(s)) S.at(s) -= 1;
  }
  
  using pis = pair<int, string>;
  priority_queue<pis> cnt;
  for (auto x : S) {  // 要素はキーと値のpair
    cnt.push(pair(x.second, x.first));
  }
  
  if (cnt.top().first < 0) cout << 0 << endl;
  else cout << cnt.top().first << endl;
  
  return 0;
}
