#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, y1;
  cin >> n >> y1;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int m, y2;
  cin >> m >> y2;
  vector<int> b(m);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  int ans = 2;
  int cur = 2;
  while (cur < 1000000000) {
    map<int, int> cnt;
    for (int i = 0; i < n; i++) {
      int mod = a[i] % cur;
      cnt[mod]++;
    }
    for (int i = 0; i < m; i++) {
      int mod = (b[i] - cur / 2) % cur;
      if (mod < 0) {
        mod += cur;
      }
      cnt[mod]++;
    }
    for (auto it = cnt.begin(); it != cnt.end(); it++) {
      ans = max(ans, it->second);
    }
    cur *= 2;
  }
  cout << ans << endl;
}
