#include <bits/stdc++.h>
using namespace std;
using P = pair<string, int>;
int main() {
  unordered_map<string, int> map;
  int N, M;
  cin >> N;
  while (N--) {
    string s;
    cin >> s;
    if (map.find(s) == map.end()) {
      map[s] = 0;
    }
    map[s]++;
  }
  cin >> M;
  while (M--) {
    string s;
    cin >> s;
    if (map.find(s) == map.end()) {
      map[s] = 0;
    }
    map[s]--;
  }
  int ans = 0;
  for (P p : map) {
    ans = max(ans, p.second);
  }
  cout << ans << endl;
}
