#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, s1 = 0, s2 = 0;
  cin >> n;
  vector<int> v1(n);
  for (int i = 0; i < n; i++) cin >> v1[i];
  cin >> m;
  vector<int> v2(m);
  for (int i = 0; i < m; i++) cin >> v2[i];
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  int res = 0;
  while (s1 < n && s2 < m) {
    if (abs(v1[s1] - v2[s2]) <= 1) {
      res++;
      s1++;
      s2++;
    } else if (v1[s1] > v2[s2])
      s2++;
    else
      s1++;
  }
  cout << res << endl;
  return 0;
}
