#include <bits/stdc++.h>
using namespace std;
int a[10003], b[10003];
bool c[1000 * 1000 + 3];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) cin >> b[i];
  sort(b, b + m);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (abs(a[i] - b[j]) <= 1 && c[j] == 0) ans++, i++, c[j] = 1;
    }
  }
  cout << ans;
}
