#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a[100 + 10], b[100 + 10];
  int D[100 + 10][100 + 10];
  cin >> n;
  for (__typeof(n) i = (1); i < (n) + (1); i++) {
    cin >> a[i];
  }
  cin >> m;
  for (__typeof(m) i = (1); i < (m) + (1); i++) {
    cin >> b[i];
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  bool flag = false;
  for (__typeof(m) j = (1); j < (m) + (1); j++) {
    if ((abs(b[j] - a[1]) <= 1) || flag) {
      flag = true;
      D[1][j] = 1;
    }
  }
  flag = false;
  for (__typeof(n) i = (1); i < (n) + (1); i++) {
    if ((abs(a[i] - b[1]) <= 1) || flag) {
      flag = true;
      D[i][1] = 1;
    }
  }
  for (__typeof(n) i = (2); i < (n) + (2); i++) {
    for (__typeof(m) j = (2); j < (m) + (2); j++) {
      if (abs(a[i] - b[j]) <= 1) {
        D[i][j] = max(D[i - 1][j - 1] + 1, max(D[i - 1][j], D[i][j - 1]));
      } else {
        D[i][j] = max(D[i - 1][j], D[i][j - 1]);
      }
    }
  }
  cout << D[n][m] << endl;
}
