#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i = 0, j = 0, count = 0;
  cin >> n;
  int arr1[n];
  for (int i = 0; i < n; i++) cin >> arr1[i];
  cin >> m;
  int arr2[m];
  for (int i = 0; i < m; i++) cin >> arr2[i];
  sort(arr1, arr1 + n);
  sort(arr2, arr2 + m);
  for (i = 0; i < n;) {
    if (j == m) break;
    if (abs(arr1[i] - arr2[j]) <= 1) {
      j++;
      i++;
      count++;
      continue;
    }
    if (arr2[j] > arr1[i]) {
      i++;
      continue;
    } else
      j++;
  }
  cout << count;
  return 0;
}
