#include <bits/stdc++.h>
using namespace std;
map<string, int> mp, mp1;
int main() {
  int n, m;
  string s;
  cin >> n;
  while (n--) {
    cin >> s;
    mp[s]++;
  }
  cin >> m;
  while (m--) {
    cin >> s;
    mp1[s]++;
  }
  int MAX = 0;
  map<string, int>::iterator it = mp.begin();
  for (; it != mp.end(); it++) {
    MAX = max(MAX, (*it).second - mp1[(*it).first]);
  }
  cout << MAX << endl;
  return 0;
}
