#include <bits/stdc++.h>
using namespace std;
long long sum, n, m, b[1010], g[1010], sb, sg;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> b[i];
  sort(b, b + n);
  cin >> m;
  for (int i = 0; i < m; i++) cin >> g[i];
  sort(g, g + m);
  while (sb != n && sg != m) {
    if (abs(b[sb] - g[sg]) == 1 || abs(b[sb] - g[sg]) == 0)
      sum++, sb++, sg++;
    else if (b[sb] > g[sg])
      sg++;
    else
      sb++;
  }
  cout << sum << endl;
  return 0;
}
