PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000028. Ghép cặp khiêu vũ (BerSU Ball)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

2 lộ trình

Ghép cặp khiêu vũ (BerSU Ball)

BerSU Ball

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn boys and mm girls with integer skill levels. A pair is valid if their skill difference is at most 11. Each person may belong to at most one pair. Find the maximum number of pairs.

Input

The first line contains nn, the second the boys' skills; the third contains mm, the fourth the girls' skills.

Output

Print the maximum number of pairs.

Constraints

  • 1≤n,m≤1001\le n,m\le 100.
  • 1≤ai,bj≤1001\le a_i,b_j\le 100 for 1≤i≤n1\le i\le n, 1≤j≤m1\le j\le m.

Subtasks

  • Subtask 1 (20 points): n,m≤8n,m\le 8.
  • Subtask 2 (30 points): n,m≤30n,m\le 30.
  • Subtask 3 (50 points): Full constraints.

Examples

Input

4
1 4 6 2
5
5 1 5 7 9

Output

3

Explanation

The sample follows the ordering rule described in the Vietnamese explanation and produces the shown optimum.