#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  vector<string> b(n);
  for (int i = 0; i < n; i++) cin >> b[i];
  cin >> m;
  vector<string> a(m);
  for (int i = 0; i < m; i++) cin >> a[i];
  int res = 0;
  for (int i = 0; i < n; i++) {
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      if (b[i] == b[j]) cnt++;
    }
    for (int j = 0; j < m; j++) {
      if (b[i] == a[j]) cnt--;
    }
    res = max(res, cnt);
  }
  cout << res << endl;
}
