#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a[102] = {0}, b[102] = {0}, j, i, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  ;
  cin >> m;
  for (int i = 0; i < m; i++) cin >> b[i];
  ;
  sort(a, a + n);
  sort(b, b + m);
  for (i = 0, j = 0; i < n && j < m;) {
    if (a[i] - 1 > b[j])
      j++;
    else if (a[i] < b[j] - 1)
      i++;
    else
      ans++, j++, i++;
  }
  cout << ans;
}
