#include <bits/stdc++.h>
using namespace std;
int n, m, l, ans = 2;
int a[100007], b[100007], p[100007 << 1], t;
long long k;
inline int read() {
  register int s = 0, p = 1;
  register char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) s = (s << 1) + (s << 3) + c - '0', c = getchar();
  return s * p;
}
inline void solve(register int k) {
  register int i, j;
  l = k << 1, t = 0;
  for (i = 1; i <= n; i++) p[++t] = (a[i] % l + l) % l;
  for (i = 1; i <= m; i++) p[++t] = (b[i] % l + l + k) % l;
  sort(p + 1, p + 1 + t), i = 1;
  while (i <= t) {
    j = i + 1;
    while (j <= t && p[j] == p[j - 1]) ++j;
    ans = max(ans, j - i), i = j;
  }
}
int main() {
  int i, j;
  n = read(), i = read();
  for (i = 1; i <= n; i++) a[i] = read();
  m = read(), i = read();
  for (i = 1; i <= m; i++) b[i] = read();
  sort(a + 1, a + n + 1), sort(b + 1, b + m + 1);
  for (k = 1; k < 500000007; k <<= 1) solve(k);
  printf("%d", ans);
  return 0;
}
