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