#include <bits/stdc++.h>
using namespace std;
int main() {
  int b, g, i, j, c = 0;
  cin >> b;
  int brr[b];
  for (i = 0; i < b; i++) cin >> brr[i];
  cin >> g;
  int grr[g];
  for (i = 0; i < g; i++) cin >> grr[i];
  sort(brr, brr + b);
  sort(grr, grr + g);
  for (i = 0, j = 0; i < b, j < g;) {
    if (brr[i] == grr[j] || abs(brr[i] - grr[j]) == 1) {
      c++;
      i++;
      j++;
    } else if (brr[i] < grr[j] && grr[j] - brr[i] > 1) {
      i++;
      j = j + 0;
    } else if (brr[i] > grr[j] && brr[i] - grr[j] > 1) {
      j++;
      i = i + 0;
    }
  }
  cout << c;
  return 0;
}
