#include using namespace std; #define int long long #define rep(i,n) for(int i=0;i<(int)(n);i++) #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define all(x) (x).begin(),(x).end() #define pb push_back #define mp make_pair #define mt make_tuple typedef pair pii; typedef vector vi; typedef vector vvi; const int inf = 1LL<<60; const int mod = 1e9 + 7; const double eps = 1e-9; /*{ }*/ signed main() { int nw; cin >> nw; vi w(nw); rep(i, nw) cin >> w[i]; int nb; cin >> nb; vi b(nb); rep(i, nb) cin >> b[i]; sort(all(w)); sort(all(b)); int ans = 0; // 白から int len = w[0]; int cnt, i, j; for(i = 1, j = 0, cnt = 1; i < nw and j < nb;){ if(cnt%2){ while(j < nb and len >= b[j]) j++; if(j < nb and len < b[j]){ len = b[j]; cnt++; } }else{ while(i < nw and len >= w[i]) i++; if(i < nw and len < w[i]){ len = w[i]; cnt++; } } } ans = cnt; len = b[0]; for(i = 0, j = 1, cnt = 1; i < nw and j < nb;){ if(cnt%2){ while(i < nw and len >= w[i]) i++; if(i < nw and len < w[i]){ len = w[i]; cnt++; } }else{ while(j < nb and len >= b[j]) j++; if(j < nb and len < b[j]){ len = b[j]; cnt++; } } } cout << max(ans, cnt) << endl; return 0; }