#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5;
int n, m, y, a[maxn], b[maxn], ans, res, c[maxn * 2], cnt, len;
int read() {
  int tot = 0, fh = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fh = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    tot = tot * 10 + c - '0';
    c = getchar();
  }
  return tot * fh;
}
void getstr(char *a) {
  char ch = getchar();
  int len = 0;
  while (ch < 'a' || ch > 'z') ch = getchar();
  while (ch >= 'a' && ch <= 'z') {
    a[++len] = ch;
    ch = getchar();
  }
}
map<int, int> A;
int main() {
  n = read();
  y = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  m = read();
  y = read();
  for (int i = 1; i <= m; i++) b[i] = read();
  ans = 0;
  for (int i = 1; i <= n; i++) c[++cnt] = a[i];
  for (int i = 1; i <= m; i++) c[++cnt] = b[i];
  sort(c + 1, c + n + m + 1);
  for (int i = 2; i <= n + m; i++)
    if (c[i] == c[i - 1]) ans = 2;
  for (int i = 1; i <= 30; i++) {
    len = 1 << i;
    for (int i = 1; i <= n; i++) {
      A[(a[i] % len + len) % len]++;
      ans = max(ans, A[(a[i] % len + len) % len]);
    }
    for (int i = 1; i <= m; i++) {
      A[((b[i] % len + len) % len + len / 2) % len]++;
      ans = max(ans, A[((b[i] % len + len) % len + len / 2) % len]);
    }
    A.erase(A.begin(), A.end());
  }
  cout << ans << "\n";
  return 0;
}
