#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 1;
int n, m, y, _y, ans;
int x[MAX], _x[MAX];
map<int, int> ma, Ma;
int main() {
  scanf("%d%d", &n, &y);
  for (int i = 1; i <= n; ++i) scanf("%d", &x[i]), Ma[x[i]] = 1;
  scanf("%d%d", &m, &_y);
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &_x[i]);
    if (Ma[_x[i]] == 1) ans = 2;
  }
  for (int tt = 2; tt <= 1e9; tt <<= 1) {
    ma.clear();
    for (int i = 1; i <= n; ++i) ans = max(ans, ++ma[x[i] % tt]);
    for (int i = 1; i <= m; ++i) ans = max(ans, ++ma[(_x[i] + (tt >> 1)) % tt]);
  }
  return printf("%d", ans), 0;
}
