#include <bits/stdc++.h>
using namespace std;
int n, m;
int dp[101][101];
vector<int> boy, girl;
int f(int i, int j) {
  int c = 0;
  if (i == n || j == m) {
    return 0;
  }
  if (abs(boy[i] - girl[j]) <= 1) return c = 1 + f(i + 1, j + 1);
  if (dp[i][j] != -1) {
    return dp[i][j];
  }
  int k = f(i, j + 1);
  int l = f(i + 1, j);
  return dp[i][j] = max(c, max(l, k));
}
int main() {
  cin >> n;
  memset(dp, -1, sizeof dp);
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    boy.push_back(x);
  }
  sort(boy.begin(), boy.end());
  cin >> m;
  for (int j = 0; j < m; j++) {
    cin >> x;
    girl.push_back(x);
  }
  sort(girl.begin(), girl.end());
  cout << f(0, 0);
}
