#include <bits/stdc++.h>
using std::map;
using std::pair;
map<int, int> mp;
int n, x, m, a[100005], b[100005], ans;
int main() {
  scanf("%d%d", &n, &x);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  scanf("%d%d", &m, &x);
  for (int i = 1; i <= m; i++) scanf("%d", &b[i]);
  ans = 2;
  for (int d = 2; d < 1e9; d <<= 1) {
    mp.clear();
    for (int i = 1; i <= n; i++) mp[a[i] % d]++;
    for (int i = 1; i <= m; i++) mp[(b[i] + d / 2) % d]++;
    for (auto i : mp) ans = std::max(ans, i.second);
  }
  printf("%d\n", ans);
}
