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