#include <bits/stdc++.h>
using namespace std;
long long int dp[110][110];
long long int g[110], b[110];
long long int fun(long long int i, long long int j, long long int ng,
                  long long int nb) {
  if (i < 0 || j < 0) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  if (abs(g[i] - b[j]) <= 1) {
    return (dp[i][j] = 1 + fun(i - 1, j - 1, ng, nb));
  }
  return dp[i][j] = (max(fun(i - 1, j, ng, nb), fun(i, j - 1, ng, nb)));
}
int main() {
  long long int nb, ng, i, temp, j;
  for (i = 0; i < 110; i++)
    for (j = 0; j < 110; j++) dp[i][j] = -1;
  cin >> nb;
  for (i = 0; i < nb; i++) {
    cin >> b[i];
  }
  cin >> ng;
  for (i = 0; i < ng; i++) {
    cin >> g[i];
  }
  sort(g, g + ng);
  sort(b, b + nb);
  temp = fun(ng - 1, nb - 1, ng, nb);
  cout << temp;
  return 0;
}
