#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 5;
long long ans = 2;
long long a[MAXN], b[MAXN];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, y, m;
  cin >> n >> y;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  cin >> m >> y;
  for (long long i = 0; i < m; ++i) cin >> b[i];
  long long chk = 0;
  for (long long log = 0; log <= 30; ++log) {
    map<long long, long long> cnt;
    long long pw = (1LL << log);
    long long mod = 2 * pw;
    for (long long i = 0; i < n; ++i) {
      cnt[a[i] % mod]++;
    }
    for (long long i = 0; i < m; ++i) {
      cnt[(b[i] + pw) % mod]++;
    }
    for (auto it : cnt) {
      ans = max(ans, it.second);
    }
  }
  cout << ans;
  return 0;
}
