#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m, y;
  vector<int> a, b;
  cin >> n >> y;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  cin >> m >> y;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    b.push_back(x);
  }
  int ans = 0;
  map<int, int> opposite;
  for (int x : a) opposite[x]++;
  for (int x : b) opposite[x]++;
  for (auto it : opposite)
    if (it.second > ans) ans = it.second;
  for (long long dx = 1; dx < 2e9; dx *= 2) {
    long long dx2 = 2 * dx;
    map<long long, int> classes;
    for (int x : a) classes[x % dx2]++;
    for (int x : b) classes[(x + dx) % dx2]++;
    int max = 0;
    for (auto it : classes)
      if (it.second > max) max = it.second;
    if (max > ans) ans = max;
  }
  cout << ans;
  return 0;
}
