#include <bits/stdc++.h>
using namespace std;
using INT = long long;
const int NN = 272727;
int a[NN], b[NN];
map<int, int> M;
int main() {
  int n, y1;
  cin >> n >> y1;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  int m, y2;
  cin >> m >> y2;
  for (int i = 1; i <= m; i++) scanf("%d", b + i);
  int fl = 0;
  for (int i = 1; i <= n; i++) M[a[i]] = 1;
  for (int i = 1; i <= m; i++) {
    if (M[b[i]]) fl = 1;
  }
  int ans = 0;
  for (int c = 0; c < 30; c++) {
    int val = 1 << c;
    M.clear();
    for (int i = 1; i <= n; i++) {
      int v = a[i] % (val * 2);
      M[v]++;
      ans = max(ans, M[v]);
    }
    for (int i = 1; i <= m; i++) {
      int v = (b[i] + val) % (val * 2);
      M[v]++;
      ans = max(ans, M[v]);
    }
  }
  if (fl) ans = max(ans, 2);
  cout << ans << endl;
  return 0;
}
