#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, x;
  cin >> n;
  vector<int> a, b;
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  cin >> m;
  for (long long int i = 0; i < m; i++) {
    cin >> x;
    b.push_back(x);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  int g = 0;
  int i = 0, j = 0;
  while (i < n && j < m) {
    if (abs(a[i] - b[j]) <= 1) {
      g++;
      i++;
      j++;
    } else {
      if (a[i] < b[j])
        i++;
      else
        j++;
    }
  }
  cout << g;
}
