1
4
3
4 4 4
 3
7 7 7
4
2 7 2 4
 3
5 4 5
2
2 1
 100
9 90 66 62 60 9 10 97 47 73 26 81 97 60 80 84 19 4 25 77 19 17 91 12 1 27 15 54 18 45 71 79 96 90 51 62 9 13 92 34 7 52 55 8 16 61 96 12 52 38 50 9 60 3 30 3 48 46 77 64 90 35 16 16 21 42 67 70 23 19 90 14 50 96 98 92 82 62 7 51 93 38 84 82 37 78 99 3 20 69 44 96 94 71 3 55 27 86 92 82
1
58
 1
3
2
2 3
 1
4
5
2 5 5 3 1
 2
2 2
1
2
 1
2
4
3 1 4 2
 5
5 2 3 1 4
4
1 3 1 7
 2
2 7
2
6 8
 2
4 3
4
5 5 5 6
 2
3 1
2
2 4
 2
5 6
3
1 5 100
 4
4 4 6 6
2
2 1
 2
2 3
2
2 1
 3
3 2 1
3
1 2 3
 10
20 87 3 39 20 20 8 40 70 51
100
69 84 81 84 35 97 69 68 63 97 85 80 95 58 70 91 100 65 72 80 41 87 87 87 22 49 96 96 78 96 97 56 90 31 62 98 89 74 100 86 95 88 66 54 93 62 41 60 95 79 29 69 63 70 52 63 87 58 54 52 48 57 26 75 39 61 98 78 52 73 99 49 74 50 59 90 31 97 16 85 63 72 81 68 75 59 70 67 73 92 10 88 57 95 3 71 80 95 84 96
 3
6 3 4
3
4 5 2
 4
2 5 1 2
4
2 3 3 1
 4
4 5 4 4
5
5 3 4 2 4
 2
4 5
2
5 3
 4
4 10 15 17
4
3 12 16 16
 4
4 3 2 1
4
1 2 3 4
 1
2
1
1
 2
5 5
4
1 1 1 5
 3
3 1 1
3
2 4 4
 2
2 4
3
3 1 8
 1
3
2
3 2
 3
3 2 1
3
2 4 3
 5
1 6 5 5 6
1
2
 2
4 2
2
4 4
 3
2 7 5
3
2 4 8
 2
5 7
5
4 6 7 2 5
 4
9 1 7 1
5
9 9 9 8 4
 5
9 8 10 9 10
5
2 1 5 4 6
 3
2 3 5
3
3 4 6
 2
7 5
2
6 8
 2
1 10
1
9
 3
1 2 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 44 46 57 24 46 82 15 44 81 40 65 17 64 24 42 52 13 12 64 82 26 7 66 85 93 89 58 92 92 77 37 91 47 73 35 69 31 22 60 60 97 21 52 6
 3
1 3 4
3
2 1 5
 2
5 4
2
4 6
 100
10 10 9 18 56 64 92 66 54 42 66 65 58 5 74 68 80 57 58 30 58 69 70 13 38 19 34 63 38 17 26 24 66 83 48 77 44 37 78 97 13 90 51 56 60 23 49 32 14 86 90 100 13 14 52 69 85 95 81 53 5 3 91 66 2 64 45 59 7 30 80 42 61 82 70 10 62 82 5 34 50 28 24 47 85 68 27 50 24 61 76 17 63 24 3 67 83 76 42 60
10
66 74 40 67 28 82 99 57 93 64
 2
10 12
2
11 9
 2
3 2
2
3 4
 4
3 1 1 1
3
1 6 7
 5
1 2 3 4 5
5
2 3 4 5 1
 4
1 6 9 15
2
5 8
 2
2 3
2
3 1
 2
2 4
2
3 1
 5
4 1 3 1 4
3
6 3 6
 3
1 2 3
3
3 2 1
 2
5 3
2
4 6
 2
4 1
3
2 3 2
 4
1 1 3 3
4
2 2 1 1
 3
1 3 3
5
1 3 4 1 2

1
 1
 0
 0
 1
 1
 1
 1
 3
 1
 1
 2
 1
 0
 2
 3
 6
 3
 3
 4
 2
 3
 4
 1
 1
 2
 2
 1
 3
 1
 1
 3
 2
 2
 0
 3
 2
 1
 1
 2
 76
 2
 100
 4
 2
 1
 1
 1
 3
 2
 9
 2
 2
 1
 5
 2
 2
 2
 1
 3
 2
 2
 4
 3

import java.util.*;
import java.io.*;

public class Main {
    static Reader scan;
    static PrintWriter out;
    static int boysCount;
    static int girlsCount;
    static int[] boys;
    static int[] girls;
    
    public static void main(String[] args) throws IOException  {
        scan = new Reader();
        out = new PrintWriter(System.out, true);
        
        boysCount = scan.nextInt();
        boys = new int[boysCount];
        for(int i = 0; i < boysCount; i++) boys[i] = scan.nextInt();
        Arrays.sort(boys);

        girlsCount = scan.nextInt();
        girls = new int[girlsCount];
        for(int i = 0; i < girlsCount; i++) girls[i] = scan.nextInt();
        Arrays.sort(girls);
        
        out.println(getPairs());
        
    }
    public static int getPairs(){
    	int pairs = 0;
    	boysCount--;
    	girlsCount--;
    	while(boysCount > -1 && girlsCount > -1){
    		int boySkill = boys[boysCount];
    		int girlSkill = girls[girlsCount];
    		if(boySkill <= girlSkill+1 && boySkill >= girlSkill-1){
    			boysCount--;
    	    	girlsCount--;
    	    	pairs++;
    		} else{
    			if (boySkill > girlSkill) boysCount--;
    			else girlsCount--;
    		}
    	}
    	return pairs;
    }    
}

class Reader {
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;
    public Reader(){
        din=new DataInputStream(System.in);
        buffer=new byte[BUFFER_SIZE];
        bufferPointer=bytesRead=0;
    }

    public Reader(String file_name) throws IOException{
        din=new DataInputStream(new FileInputStream(file_name));
        buffer=new byte[BUFFER_SIZE];
        bufferPointer=bytesRead=0;
    }

    public String readLine() throws IOException{
        byte[] buf=new byte[64]; // line length
        int cnt=0,c;
        while((c=read())!=-1){
            if(c=='\n')break;
            buf[cnt++]=(byte)c;
        }
        return new String(buf,0,cnt);
    }

    public int nextInt() throws IOException{
        int ret=0;byte c=read();
        while(c<=' ')c=read();
        boolean neg=(c=='-');
        if(neg)c=read();
        do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');
        if(neg)return -ret;
        return ret;
    } 

    public long nextLong() throws IOException{
        long ret=0;byte c=read();
        while(c<=' ')c=read();
        boolean neg=(c=='-');
        if(neg)c=read();
        do{ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');
        if(neg)return -ret;
        return ret;
    }

    public double nextDouble() throws IOException{
        double ret=0,div=1;byte c=read();
        while(c<=' ')c=read();
        boolean neg=(c=='-');
        if(neg)c = read();
        do {ret=ret*10+c-'0';}while((c=read())>='0'&&c<='9');
        if(c=='.')while((c=read())>='0'&&c<='9')
            ret+=(c-'0')/(div*=10);
        if(neg)return -ret;
        return ret;
    }
    
    private void fillBuffer() throws IOException{
        bytesRead=din.read(buffer,bufferPointer=0,BUFFER_SIZE);
        if(bytesRead==-1)buffer[0]=-1;
    }
    
    private byte read() throws IOException{
        if(bufferPointer==bytesRead)fillBuffer();
        return buffer[bufferPointer++];
    }
    
    public void close() throws IOException{
        if(din==null) return;
        din.close();
    }
}