#include <bits/stdc++.h>
using namespace std;
static const int N = 1e5 + 10;
int n, m, a[N], b[N], ans;
map<int, int> mp;
int main() {
  scanf("%d%*d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  scanf("%d%*d", &m);
  for (int i = 1; i <= m; ++i) scanf("%d", &b[i]);
  ans = 2;
  for (int d = 1; d <= 1e9; d <<= 1) {
    mp.clear();
    for (int i = 1; i <= n; ++i)
      ++mp[a[i] % (d << 1)], ans = max(ans, mp[a[i] % (d << 1)]);
    for (int i = 1; i <= m; ++i)
      ++mp[(b[i] + d) % (d << 1)], ans = max(ans, mp[(b[i] + d) % (d << 1)]);
  }
  printf("%d", ans);
  return 0;
}
