#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, x = 0, l = 0;
  string s;
  cin >> N;
  map<string, int> S, T, num;
  set<string> s1, t1;
  for (int i = 0; i < N; i++) {
    cin >> s;
    s1.insert(s);
    S[s]++;
  }
  cin >> M;
  for (int i = 0; i < M; i++) {
    cin >> s;
    t1.insert(s);
    T[s]++;
  }
  for (auto itr1 : s1) {
    for (auto itr2 : t1) {
      if (itr1 == itr2) {
        if (S[itr1] >= T[itr2]) num[itr1] = S[itr1] - T[itr2];
      } else
        l++;
    }
    if (l == t1.size()) num[itr1] = S[itr1];
  }
  for (auto itr : s1) {
    if (num[itr] >= x) x = num[itr];
  }
  cout << x << endl;
  return 0;
}
