#include<bits/stdc++.h>
#define ll long long
#define INF 100000000000000000LL
using namespace std;
signed main() {
  int n, m, cun, ans = 0;
  string s[10000], t[10000];
  
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> t[i];   
  } 
  
  for (int i = 0; i < n; i++) {
    cun = 0;
    for (int j = 0; j < n; j++) {
      if (s[i] == s[j]) {
        cun++;
      }
    }
    
    for (int j = 0; j <m; j++) {
      if (s[i] == t[j]) {
        cun--;
      }
    }
    ans = max(ans, cun);
  }
  
  cout << ans << "\n";
  return (0);
}
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  int N,M;
  cin >> N;
  map<string,int> blue;
  string s;
  for(int i=0;i<N;++i){
    cin >> s;
    if(blue.count(s)) blue.at(s)++;
    else blue[s]=1;
  }
  cin >> M;
  map<string,int> red;
  for(int i=0;i<M;++i){
    cin >> s;
    if(red.count(s)) red.at(s)++;
    else red[s]=1;
  }

  int ans=-200;
  for(auto p: blue){
    auto word=p.first;
    auto value=p.second;
    if(red.count(word)){
      ans=max(ans,value-red.at(word));
    }
    else ans=max(ans,value);
  }

  if(ans<0) cout << 0 << endl;
  else cout << ans << endl;
  
  return 0;
}
