#include <bits/stdc++.h>
using namespace std;
int n, m, x, a[100010], b[100010];
long long p;
int ans;
map<long long, int> MP[33];
int main() {
  scanf("%d%d", &n, &x);
  p = 1;
  for (int i = 0; i < 31; i++) p *= 2;
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  scanf("%d%d", &m, &x);
  for (int i = 0; i < m; i++) scanf("%d", b + i);
  for (int j = 0; j < n; j++) {
    MP[0][a[j]]++;
    ans = max(ans, MP[0][a[j]]);
  }
  for (int j = 0; j < m; j++) {
    MP[0][b[j]]++;
    ans = max(ans, MP[0][b[j]]);
  }
  for (long long i = 2, k = 1; i <= p; i *= 2, k++) {
    for (int j = 0; j < n; j++) {
      MP[k][a[j] % i]++;
      ans = max(ans, MP[k][a[j] % i]);
    }
    for (int j = 0; j < m; j++) {
      MP[k][(b[j] + i / 2) % i]++;
      ans = max(ans, MP[k][(b[j] + i / 2) % i]);
    }
  }
  printf("%d", ans);
  return 0;
}
