#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
int solve(vector<int>& a, vector<int>& b, int S) {
  S *= 2;
  unordered_map<int, int> cnt;
  for (auto& it : a) {
    cnt[it % S]++;
  }
  for (auto& it : b) {
    cnt[(it + S / 2) % S]++;
  }
  int ret = 0;
  for (auto& it : cnt) {
    ret = max(ret, it.second);
  }
  return ret;
}
int main() {
  int n, m, Y;
  scanf("%d%d", &n, &Y);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  scanf("%d%d", &m, &Y);
  vector<int> b(m);
  for (int i = 0; i < m; ++i) {
    scanf("%d", &b[i]);
  }
  int ret = 2;
  for (long long S = 1; S <= (1 << 30); S <<= 1) {
    ret = max(ret, solve(a, b, S));
  }
  printf("%d\n", ret);
  return 0;
}
