#include <bits/stdc++.h>
using namespace std;
int main() {
  long int b, g;
  scanf("%ld", &b);
  long int boys[b];
  bool pBoys[b];
  for (long int i = 0; i < b; i++) pBoys[i] = false, scanf("%ld", &boys[i]);
  scanf("%ld", &g);
  long int girls[g];
  bool pGirls[g];
  for (long int j = 0; j < g; j++) pGirls[j] = false, scanf("%ld", &girls[j]);
  sort(boys, boys + b);
  sort(girls, girls + g);
  long int diff = 0;
  long int count = 0;
  for (long int i = 0; i < b; i++)
    for (long int j = 0; j < g; j++) {
      diff = abs(boys[i] - girls[j]);
      if (diff <= 1 && (!pBoys[i] && !pGirls[j])) {
        pBoys[i] = true;
        pGirls[j] = true;
        count++;
      }
    }
  printf("%ld\n", count);
  return 0;
}
