#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int n, m; cin >> n; vector a(n); rep(i, n) cin >> a[i]; cin >> m; vector b(m); rep(i, m) cin >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); int ans = 0; rep(_, 2) { // _ == 0 : 白から, 1 : 黒から int now = (_ ? b[0] : a[0]), cnt = 1; while (true) { if (cnt % 2 != _) { // 黒 auto it = upper_bound(b.begin(), b.end(), now); if (it == b.end()) break; now = *it; cnt++; } else { // 白 auto it = upper_bound(a.begin(), a.end(), now); if (it == a.end()) break; now = *it; cnt++; } } ans = max(ans, cnt); } cout << ans << endl; return 0; }