#include <bits/stdc++.h>
int main(void) {
  int n, m, count = 0, max = 0;
  scanf("%d", &n);
  char s[n][10 + 1];
  for (int i = 0; i < n; i++) scanf("%s", s[i]);
  scanf("%d", &m);
  char t[m][10 + 1];
  for (int i = 0; i < m; i++) scanf("%s", t[i]);
  for (int i = 0; i < n; i++) {
    count = 0;
    for (int j = 0; j < n; j++) {
      if (strcmp(s[i], s[j]) == 0) count++;
    }
    for (int j = 0; j < m; j++) {
      if (strcmp(s[i], t[j]) == 0) count--;
    }
    if (count > max) max = count;
  }
  printf("%d", max);
}
