#include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() using namespace std; typedef long long ll; typedef pair pi; typedef pair pl; typedef pair pls; int check(priority_queue pq1, priority_queue pq2) { int size1 = 1, pre = pq1.top(); pq1.pop(); for (int i = 0; ;) { int next; if (i % 2 == 0) { if (pq2.empty())break; next = pq2.top(); pq2.pop(); } else { if (pq1.empty())break; next = pq1.top(); pq1.pop(); } if (pre > next) { size1++; pre = next; i++; } } return size1; } int main() { int Nw, Nb; priority_queue pq1, pq2, pq1_tmp, pq2_tmp; cin >> Nw; for (int i = 0; i < Nw; i++) { int w; cin >> w; pq1.push(w); pq1_tmp.push(w); } cin >> Nb; for (int i = 0; i < Nb; i++) { int w; cin >> w; pq2.push(w); pq2_tmp.push(w); } cout << max(check(pq1,pq2),check(pq2_tmp,pq1_tmp)) << endl; return 0; }