#include <bits/stdc++.h>
int main(void) {
  using namespace std;
  string input;
  int blueCards, redCards;
  map<string, int> cardList;
  getline(cin, input);
  blueCards = stoi(input);
  for (int i = 0; i < blueCards; ++i) {
    getline(cin, input);
    ++cardList[input];
  }
  getline(cin, input);
  redCards = stoi(input);
  for (int i = 0; i < redCards; ++i) {
    getline(cin, input);
    --cardList[input];
  }
  int max = 0;
  for (auto itr = cardList.begin(); itr != cardList.end(); ++itr) {
    if ((*itr).second > max) {
      max = (*itr).second;
    }
  }
  cout << max << endl;
  return 0;
}
