#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int gcd(int n, int m) {
  if (m == 0) return n;
  return gcd(m, n % m);
}
int fact(int n) {
  if (n == 1) return 1;
  return n * fact(n - 1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  int b[m];
  for (int i = 0; i < m; i++) cin >> b[i];
  sort(a, a + n);
  sort(b, b + m);
  int i = 0, j = 0;
  int count = 0;
  while (i < n and 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;
}
