#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int w = 1, s = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return w * s;
}
int X[1000010], Y[1000010];
int N, M, L, U;
unordered_map<int, int> mp;
unordered_map<int, int> tong;
int main() {
  N = read();
  L = read();
  int ans = 0;
  for (register int i = 1; i <= N; ++i)
    X[i] = read(), mp[X[i]] = 1, tong[X[i]]++, ans = max(ans, tong[X[i]]);
  M = read(), U = read();
  for (register int i = 1; i <= M; ++i)
    Y[i] = read(), mp[Y[i]] = 2, tong[Y[i]]++, ans = max(ans, tong[Y[i]]);
  for (register int i = 0; i < 30; ++i) {
    int tmp = 1 << i;
    mp.clear();
    for (register int j = 1; j <= N; ++j) {
      mp[X[j] % (2 * tmp)]++;
      ans = max(ans, mp[X[j] % (2 * tmp)]);
    }
    for (register int j = 1; j <= M; ++j) {
      mp[(Y[j] + tmp) % (2 * tmp)]++;
      ans = max(ans, mp[(Y[j] + tmp) % (2 * tmp)]);
    }
  }
  cout << ans;
  return 0;
}
