int y1, y2, ans = 0; map<int, int> mp; cin >> n >> y1; for (int i = 1; i <= n; ++i) cin >> a[i], ++mp[a[i]]; cin >> m >> y2; for (int i = 1; i <= m; ++i) cin >> b[i], ++mp[b[i]]; for (auto u : mp) ans = max(ans, u.second); for (unsignedint s = 1; s <= 2147483647; s *= 2) { map<int, int> mp; for (int i = 1; i <= n; ++i) ++mp[a[i] % (2 * s)]; for (int i = 1; i <= m; ++i) ++mp[(b[i] + s) % (2 * s)]; for (auto u : mp) ans = max(ans, u.second); } cout << ans << "\n"; return0; }