#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d", &n);
  int a[10000];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int b[10000];
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &b[i]);
  }
  sort(a, a + n);
  sort(b, b + m);
  int i = 0, j = 0, ans = 0;
  while (i != n && j != m) {
    if (abs(a[i] - b[j]) <= 1) {
      ans++;
      i++;
      j++;
    } else {
      if (a[i] > b[j]) {
        j++;
      } else {
        i++;
      }
    }
  }
  cout << ans;
  return 0;
}
