#include using namespace std; template bool cmin(T &a, U b) { return a > b && (a = b, true); } template bool cmax(T &a, U b) { return a < b && (a = b, true); } signed main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N; cin >> N; vector W(N); for (int i = 0; i < N; i++) cin >> W.at(i); int M; cin >> M; vector B(M); for (int i = 0; i < M; i++) cin >> B.at(i); multiset MS, MS2; for (auto a : W) MS.insert(a); for (auto a : B) MS2.insert(a); auto X = MS, Y = MS2; auto it = --X.end(); int now = *it; X.erase(it); int ans = 1; while (true) { it = Y.lower_bound(now); if (it == Y.begin()) break; it--; now = *it; Y.erase(it); ans++; it = X.lower_bound(now); if (it == X.begin()) break; it--; now = *it; X.erase(it); ans++; } X = MS2, Y = MS; it = --X.end(); now = *it; X.erase(it); int ans2 = 1; while (true) { it = Y.lower_bound(now); if (it == Y.begin()) break; it--; now = *it; Y.erase(it); ans2++; it = X.lower_bound(now); if (it == X.begin()) break; it--; now = *it; X.erase(it); ans2++; } cout << max(ans, ans2) << "\n"; }