#include <bits/stdc++.h>
using namespace std;
using INT = long long;
const int NN = 202020;
int a[NN], b[NN];
map<int, int> mp;
int main() {
  int n, y;
  cin >> n >> y;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int m, yy;
  cin >> m >> yy;
  for (int i = 1; i <= m; i++) cin >> b[i];
  int ans = 2;
  for (int bt = 0; bt < 30; bt++) {
    int d = (1 << bt);
    mp.clear();
    for (int i = 1; i <= n; i++) {
      int ha = a[i] % (2 * d);
      mp[ha]++;
      ans = max(ans, mp[ha]);
    }
    for (int i = 1; i <= m; i++) {
      int ha = (b[i] + d) % (2 * d);
      mp[ha]++;
      ans = max(ans, mp[ha]);
    }
  }
  cout << ans;
}
