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