#include <bits/stdc++.h>
using namespace std;
int a[100], b[100];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  sort(a, a + n);
  sort(b, b + m);
  int l = 0, r = 0, ans = 0;
  while (l < n && r < m) {
    if (a[l] < b[r] - 1) {
      l++;
    } else if (b[r] < a[l] - 1) {
      r++;
    } else {
      ans++;
      l++;
      r++;
    }
  }
  cout << ans << endl;
}
