#include <bits/stdc++.h>
using namespace std;
inline vector<string> __split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
inline void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
inline void err(vector<string>::iterator it, T a, Args... args) {
  auto item = it->substr((*it)[0] == ' ', it->length());
  cout << item << ": " << a << '\n';
  cerr << item << ": " << a << '\n';
  err(++it, args...);
}
static char buff[(int)1e6 + 17];
static constexpr long long inf = (long long)1e9 + 7ll;
inline void __config_io(const bool& __fastio) {
  if (__fastio) ios_base::sync_with_stdio(false), cin.tie(nullptr);
  if (!std::string("").empty()) {
    assert(freopen(""
                   ".in",
                   "r", stdin) != nullptr);
    assert(freopen(""
                   ".out",
                   "w", stdout) != nullptr);
  }
}
const int maxn = (int)3e3 + 17;
int n, m, ans;
int a[maxn], b[maxn];
int main() {
  __config_io(false);
  scanf("%d", &n);
  for (int i = 0; i < (int)n; ++i) scanf("%d", &a[i]);
  scanf("%d", &m);
  for (int i = 0; i < (int)m; ++i) scanf("%d", &b[i]);
  sort(a, a + n);
  sort(b, b + m);
  for (int i = 0, j = 0; i < n && j < m; ++i) {
    for (; j < m && b[j] <= a[i] + 1 && abs(a[i] - b[j]) > 1; ++j)
      ;
    if (j < m && abs(a[i] - b[j]) <= 1) ++ans, ++j;
  }
  printf("%d\n", ans);
  return 0;
}
