#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int i, n, j, m, count = 0;
  cin >> n;
  int a[n];
  for (i = 0; i < n; ++i) {
    cin >> a[i];
  }
  cin >> m;
  int b[m];
  for (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 (abs(a[i] - b[j]) <= 1) {
      count++;
      i++;
      j++;
    } else if (a[i] > b[j]) {
      j++;
    } else {
      i++;
    }
  }
  cout << count;
  return 0;
}
