#include <bits/stdc++.h>
using namespace std;

bool item_check(vector<string> item, string x){
    int i;
    for(i=0;i<item.size();i++){
      if(x==item.at(i)){return 1;
      break;}
    }
    return 0;
}

int main() {
  int M,N,i,j;
  cin>>N;
  vector<string> s(N);
  for(i=0;i<N;i++){
    cin>>s.at(i);
  }
  cin>>M;
  vector<string> t(M);
  for(i=0;i<M;i++){
    cin>>t.at(i);
  }
  int mscore;
  string x;
  vector<string> item;

  for(i=0;i<N;i++){
    x=s.at(i);
    int count1=0;
    int count2=0;
    if(i!=0){if(item_check(item,x))continue;}
    for(j=0;j<N;i++){
      if(x==s.at(j))count1++;
    }
    for(j=0;j<M;i++){
      if(x==t.at(j))count1--;
      if(count1<0)break;
    }
    if(mscore<count1)mscore=count1;
  }

  int max_value=*max_element(score.begin(), score.end());
  cout<<max_value<<endl;

}
