#include <bits/stdc++.h>
int main() {
  int n, m;
  int max = 0, count;
  std::cin >> n;
  std::string s[n];
  for (int i = 0; i < n; i++) {
    std::cin >> s[i];
  }
  std::cin >> m;
  std::string t[m];
  for (int i = 0; i < m; i++) {
    std::cin >> t[i];
  }
  std::vector<std::string> index;
  std::vector<int> num;
  index.push_back(s[0]);
  num.push_back(1);
  count = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= count; j++) {
      if (s[i] == index[j]) {
        ++num[j];
        break;
      } else {
        if (j == count) {
          index.push_back(s[i]);
          num.push_back(1);
        }
      }
    }
  }
  for (int i = 0; i < m; ++i) {
    for (unsigned int j = 0; j <= index.size(); j++) {
      if (t[i] == index[j]) {
        --num[j];
        break;
      } else {
        if (j == index.size()) {
          index.push_back(s[i]);
          num.push_back(-1);
        }
      }
    }
  }
  max = 0;
  for (unsigned int i = 0; i < num.size(); ++i) {
    if (max < num[i]) {
      max = num[i];
    }
  }
  std::cout << max;
  return 0;
}
