#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0);
  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;
  for (long long l = 1; l <= 1e9; l <<= 1) {
    map<int, int> mp;
    for (auto i : a) ++mp[i % (2 * l)];
    for (auto i : b) ++mp[(i + l) % (2 * l)];
    for (auto i : mp) ans = max(ans, i.second);
  }
  cout << ans;
  return 0;
}
