#include <bits/stdc++.h>
using namespace std;
const int MX = 100005, lim = 1e9;
int n, m, y, a[MX], b[MX], res = 0;
map<int, int> mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> y;
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m >> y;
  for (int i = 0; i < m; i++) cin >> b[i];
  long long i = 1;
  while (i <= lim) {
    long long j = 2 * i;
    mp.clear();
    for (int k = 0; k < n; k++) mp[a[k] % j]++;
    for (int k = 0; k < m; k++) mp[(b[k] - i + j) % j]++;
    for (auto &it : mp) res = max(res, it.second);
    i *= 2;
  }
  cout << max(res, 2) << '\n';
  return 0;
}
