#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a[105], b[105];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  for (int i = 0; i < m; i++) cin >> b[i];
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++)
      if (a[i] > a[j]) {
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;
      }
  }
  for (int i = 0; i < m - 1; i++) {
    for (int j = i + 1; j < m; j++)
      if (b[i] > b[j]) {
        int temp = b[i];
        b[i] = b[j];
        b[j] = temp;
      }
  }
  int p = 0, i = 0, j = 0;
  while (i < n && j < m) {
    if (abs(a[i] - b[j]) < 2) {
      p++;
      i++;
      j++;
    } else if (a[i] < b[j])
      i++;
    else
      j++;
  }
  cout << p << endl;
  return 0;
}
