#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N;
  vector<string> s(N);
  for (int i = 0; i < N; i++) {
    cin >> s.at(i);
  }
  cin >> M;
  vector<string> t(M);
  for (int l = 0; l < M; l++) {
    cin >> t.at(l);
  }
  vector<int> answer(N);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (s.at(i) == s.at(j)) {
        answer.at(i)++;
      }
    }
    for (int k = 0; k < M; k++) {
      if (s.at(i) == t.at(k)) {
        answer.at(i)--;
      }
    }
  }
  int Max = answer.at(1);
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      if (answer.at(j) > answer.at(i)) {
        Max = answer.at(j);
      }
    }
  }
  cout << Max << endl;
}
