#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d", &n);
  int a[n], c = 0, d = 0, i, j;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  scanf("%d", &m);
  int b[m];
  for (i = 0; i < m; i++) {
    scanf("%d", &b[i]);
  }
  sort(a, a + n);
  sort(b, b + m);
  for (i = 0; i < n; i++) {
    for (j = c; j < m; j++) {
      if ((b[j] == a[i]) || (b[j] == a[i] + 1) || (b[j] == a[i] - 1)) {
        c = j + 1;
        d++;
        break;
      }
    }
  }
  printf("%d\n", d);
  return 0;
}
