#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[105], b[105];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  cin >> m;
  for (int i = 0; i < (int)(m); ++i) cin >> b[i];
  sort(a, a + n);
  sort(b, b + m);
  int ai = 0, bi = 0, ans = 0;
  while (ai < n && bi < m) {
    while (ai < n && a[ai] < b[bi] - 1) ++ai;
    if (ai == n) break;
    while (bi < m && b[bi] < a[ai] - 1) ++bi;
    if (bi == m) break;
    if (abs(a[ai] - b[bi]) <= 1) {
      ++ai;
      ++bi;
      ++ans;
    }
  }
  cout << ans << '\n';
  return 0;
}
