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