#include <bits/stdc++.h>
using namespace std;
int a[105], b[105], t[105][105];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) scanf("%d", a + i);
  scanf("%d", &m);
  for (int i = (1); i <= (m); ++i) scanf("%d", b + i);
  sort(a, a + n + 1);
  sort(b, b + m + 1);
  for (int i = (1); i <= (n); ++i)
    for (int j = (1); j <= (m); ++j)
      if (abs(a[i] - b[j]) <= 1)
        t[i][j] = 1 + t[i - 1][j - 1];
      else
        t[i][j] = max(t[i - 1][j], t[i][j - 1]);
  printf("%d\n", t[n][m]);
  return 0;
}
