#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(x,y) for(int x = 0;x < (y);x++) #define LLI long long int #define FORR(x,arr) for(auto& x:arr) #define ALL(a) (a.begin()),(a.end()) #define _L(x) cout<<(x)< class UF { public: vector _parent,_rank; UF() { _parent=_rank=vector(um,0); for(int i=0;i_rank[yRoot]) { _parent[xRoot] = yRoot; return yRoot; } if(_rank[xRoot]<_rank[yRoot]) { _parent[yRoot] = xRoot; return xRoot; } if(xRoot != yRoot) { _parent[yRoot] = xRoot; _rank[xRoot]++; return xRoot; } return xRoot; } }; int calculate(const vector& w, const vector& b, bool white) { int i = (int)w.size(); int j = (int)b.size(); int height = 0; int prevWidth = 1000000000; while(true) { if(white) { for(int index = i-1; index >= 0; index--) { if(prevWidth > w[index]) { height++; i = index; white = !white; prevWidth = w[index]; break; } } if(white) { return height; } } else { for(int index = j-1; index >= 0; index--) { if(prevWidth > b[index]) { height++; j = index; white = !white; prevWidth = b[index]; break; } } if(!white) { return height; } } } } int main() { int Nw; cin >> Nw; vector w(Nw); FOR(i, Nw) { cin >> w[i]; } int Nb; cin >> Nb; vector b(Nb); FOR(i, Nb) { cin >> b[i]; } sort(w.begin(), w.end()); sort(b.begin(), b.end()); int fromW = calculate(w, b, true); int fromB = calculate(w, b, false); cout << max(fromW, fromB) << endl; return 0; }