#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

const int N = 100;
 struct S_array{
    string str;
    int cnt = 1;        
};
struct S_array array1[N], array2[N];

int main(){
    int n, m;
    cin >> n;
    vector<string> s(n);
    for(int i = 0; i < n; i++){
        cin >> s[i];
    }
    cin >> m;
    vector<string> t(m);
    for(int i = 0; i < m; i++){
        cin >> t[i];
    }

    sort(s.begin(), s.end());
    sort(t.begin(), t.end());

    if(n == 1){
        array1[0].str = s[0];
        array1[0].cnt = 1;
    }
    if(m == 1){
        array2[0].str = t[0];
        array2[0].cnt = 1;
    }

    int tmp = 0;
    int index1, index2;
    if(n != 1){
        for(int i = 0; i < n - 1; i++){
            if(s[i] == s[i + 1]){
                array1[tmp].str = s[i];
                array1[tmp].cnt++;
            }
            else{
                array1[tmp].str = s[i];
                tmp++;
            }
        }
        if(s[n - 1] != s[n - 2]){
            array1[tmp].str = s[n - 1];
            array1[tmp].cnt = 1;;
        }
        tmp++;
        index1 = tmp;
    }
    tmp = 0;
    if(m != 1){
        for(int i = 0; i < m - 1; i++){
            if(t[i] == t[i + 1]){
                array2[tmp].str = t[i];
                array2[tmp].cnt++;
            }
            else{
                array2[i].str = t[i];
                tmp++;
            }
        }
        if(t[m - 1] != t[m - 2]){
            array2[tmp].str = t[m - 1];
            array2[tmp].cnt = 1;;
        }
        tmp++;
        index2 = tmp;
    }
    
    if(n == 1 && m == 1){
        if(array1[0].str == array2[0].str){
            cout << "0" << endl;
            return 0;
        }
        else{
            cout << "1" << endl;
            return 0;
        }
    }
    int sum = 0;
    if(n == 1){
        for(int i = 0; i < m; i++){
            if(array1[0].str == array2[i].str){
                sum = array1[0].cnt - array2[i].cnt;
                if(sum > 0){
                    cout << sum << endl;
                    return 0;
                }
                else{
                    cout << "0" << endl;
                    return 0;
                } 
            }
        }
        int max = 0;
        for(int i = 0; i < n; i++){
            if(array1[i].cnt > max){
                max = array1[i].cnt;
            }
        }
        cout << max << endl;
        return 0;
    }
    if(m == 1){
        for(int i = 0; i < n; i++){
            if(array1[i].str == array2[0].str){
                sum = array1[i].cnt - array2[0].cnt;
                if(sum > 0){
                    cout << sum << endl;
                    return 0;
                }
                else{
                    cout << "0" << endl;
                    return 0;
                }
            }
        }
        int max = 0;
        for(int i = 0; i < n; i++){
            if(array1[i].cnt > max){
                max = array1[i].cnt;
            }
        }
        cout << max << endl;
        return 0;
    }

    sum = 0;
    int max = 0;
    for(int i = 0; i < index1; i++){
        bool flag = false;
        for(int j = 0; j < index2; j++){
            if(array1[i].str == array2[j].str){
                flag = true;
                sum = array1[i].cnt - array2[j].cnt;
                if(sum > max){
                    max = sum;
                }
                break;
            }
        }
        if(!flag){
            sum = array1[i].cnt;
            if(sum > max){
                max = sum;
            }
        }
    }

    cout << max << endl;
    /*
    cout << "debug" << endl;
    for(int i = 0; i < index1; i++){
        cout << array1[i].str << " " << array1[i].cnt << endl;
    }
    for(int i = 0; i < index2; i++){
        cout << array2[i].str << " " << array2[i].cnt << endl;
    }*/

    return 0;
}

Measured memory_bytes: 256