#include #include #include using namespace std; int main() { int ws; cin >> ws; vector w(ws); for (int &wi: w) cin >> wi; int bs; cin >> bs; vector b(bs); for (int &bi: b) cin >> bi; sort(w.rbegin(), w.rend()); sort(b.rbegin(), b.rend()); int ans = 0; for (int _: {1, 2}) { int iw = 0, ib = 0; int cur = 1e5, cnt = 0; while (true) { while (iw < ws && w[iw] >= cur) iw++; if (iw == ws) break; cur = w[iw]; cnt++; while (ib < bs && b[ib] >= cur) ib++; if (ib == bs) break; cur = b[ib]; cnt++; } ans = max(ans, cnt); swap(ws, bs); swap(w, b); } cout << ans << endl; return 0; }