#include <bits/stdc++.h>
using namespace std;
void file_i_o() {}
int main() {
  int x, n, m;
  cin >> n;
  vector<int> boys, girls;
  for (int i = (0); i < (n); i++) {
    cin >> x;
    boys.push_back(x);
  }
  cin >> m;
  for (int i = (0); i < (m); i++) {
    cin >> x;
    girls.push_back(x);
  }
  sort(boys.begin(), boys.end());
  sort(girls.begin(), girls.end());
  int counter = 0;
  for (int i = (0); i < (n); i++) {
    for (int j = (0); j < (m); j++) {
      if ((abs(boys[i] - girls[j])) <= 1) {
        girls[j] = 1000;
        counter++;
        break;
      }
    }
  }
  cout << counter << endl;
}
