#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x * f;
}
int max(int a, int b) {
  if (a >= b) return a;
  return b;
}
int main() {
  int n, y1, m, y2;
  n = read();
  y1 = read();
  int a[n];
  int i, j;
  for (i = 0; i < n; i++) a[i] = read();
  m = read();
  y2 = read();
  int b[m];
  for (i = 0; i < m; i++) b[i] = read();
  map<int, int> mp;
  int ans = 0;
  for (i = 0; i <= 29; i++) {
    int mod = 1 << i;
    mp.clear();
    for (j = 0; j < n; j++) {
      mp[a[j] % (2 * mod)]++;
    }
    for (j = 0; j < m; j++) {
      mp[(b[j] + mod) % (2 * mod)]++;
    }
    map<int, int>::iterator it;
    for (it = mp.begin(); it != mp.end(); it++) {
      ans = max(ans, it->second);
    }
  }
  if (n == 1 && m == 1) ans = 2;
  cout << ans << endl;
}
