#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100], b[100];
int dp[100][100];
int mov(int i, int j) {
  if (i == n || j == m) return 0;
  if (dp[i][j] != -1) return dp[i][j];
  if (abs(a[i] - b[j]) <= 1) {
    dp[i][j] = 1 + mov(i + 1, j + 1);
  } else {
    dp[i][j] = max(dp[i][j], mov(i + 1, j));
    dp[i][j] = max(dp[i][j], mov(i, j + 1));
  }
  return dp[i][j];
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  cin >> m;
  for (int j = 0; j < m; ++j) cin >> b[j];
  sort(a, a + n);
  sort(b, b + m);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      dp[i][j] = -1;
    }
  }
  cout << mov(0, 0) << endl;
}
