#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 17;
int n, m, ans;
int a[N], b[N];
bool used1[N], used2[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> b[i];
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (abs(a[i] - b[j]) <= 1 && !used1[i] && !used2[j]) {
        used1[i] = used2[j] = true;
        ans++;
      }
    }
  }
  cout << ans;
  return 0;
}
