#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.at(i);
  vector<string> r(m);
  cin >> m;
  for (int i = 0; i < m; i++) cin >> r.at(i);
  vector<int> num(n, 0);
  int x = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++)
      if (b.at(i) == b.at(j)) num.at(i)++;
    for (int j = 0; j < m; j++)
      if (b.at(i) == r.at(j)) num.at(i)--;
    x = max(x, num.at(i));
  }
  cout << x << endl;
}
