#include <bits/stdc++.h>
using namespace std;
int f[200009];
int a[200009];
int b[200009];
int main() {
  int n, X;
  cin >> n >> X;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int m;
  cin >> m >> X;
  for (int j = 1; j <= m; j++) {
    cin >> b[j];
  }
  int ans = 2;
  for (int i = 0; i <= 29; i++) {
    vector<int> v;
    for (int j = 1; j <= n; j++) {
      v.push_back((a[j] ^ (1 << (i))) & ((1 << (i + 1)) - 1));
    }
    for (int j = 1; j <= m; j++) {
      v.push_back((b[j]) & ((1 << (i + 1)) - 1));
    }
    sort(v.begin(), v.end());
    int cnt = 1;
    for (int i = 1; i < v.size(); i++) {
      if (v[i] == v[i - 1]) {
        cnt++;
        continue;
      }
      ans = max(ans, cnt);
      cnt = 1;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}
