import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
 * 境界部分には気をつける(そこだけ別で処理するというのもあり)
 * 逆再生することで簡単になることもある
 */
public class Main {
    public Main() {
    }

    public static void main(String[] args ) {
            Main main = new Main();
            main.exec();
    }

    public void exec() {
        BufferedReader bf = null;
        try{
            bf = new BufferedReader(new InputStreamReader(System.in));
            exec_body(bf);
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally{
            if( bf != null ) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public void exec_body( BufferedReader bf ) throws IOException {
            bf.readLine();
            int[] sAry = toList(bf.readLine(),false);
            bf.readLine();
            int[] tAry = toList(bf.readLine(),false);

            int cnt = 0;
            for( int tVal : tAry ) {
            		int left = 0;
            		int right = sAry.length - 1;
            		while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		}
            }

            System.out.println(cnt);
    }

    public int[] toList( String str, boolean isBanhei ) {
            String[] elements = str.split(" ");
            int arysize = elements.length + ( (isBanhei) ? 1 : 0 );
            int[] ret = new int [arysize];
            for( int i = 0; i < elements.length; i++ ) {
                ret[i] = Integer.valueOf(elements[i]);
            }

            return ret;
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public Main() {
    }

    public static void main(String[] args ) {
            Main main = new Main();
            main.exec();
    }

    public void exec() {
        BufferedReader bf = null;
        try{
            bf = new BufferedReader(new InputStreamReader(System.in));
            exec_body(bf);
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally{
            if( bf != null ) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public void exec_body( BufferedReader bf ) throws IOException {
            bf.readLine();
            int[] sAry = toList(bf.readLine(),false);
            bf.readLine();
            int[] tAry = toList(bf.readLine(),false);

            int cnt = 0;
            for( int tVal : tAry ) {
            		int left = 0;
            		int right = sAry.length - 1;
            		while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		}
            }

            System.out.println(cnt);
    }

    public int[] toList( String str, boolean isBanhei ) {
            String[] elements = str.split(" ");
            int arysize = elements.length + ( (isBanhei) ? 1 : 0 );
            int[] ret = new int [arysize];
            for( int i = 0; i < elements.length; i++ ) {
                ret[i] = Integer.valueOf(elements[i]);
            }

            return ret;
    }
} Main public Main() {
    } Main {
    } public static void main(String[] args ) {
            Main main = new Main();
            main.exec();
    } main {
            Main main = new Main();
            main.exec();
    } Main main = new Main(); main new Main() main.exec() main.exec main String[] args args public void exec() {
        BufferedReader bf = null;
        try{
            bf = new BufferedReader(new InputStreamReader(System.in));
            exec_body(bf);
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally{
            if( bf != null ) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    } exec {
        BufferedReader bf = null;
        try{
            bf = new BufferedReader(new InputStreamReader(System.in));
            exec_body(bf);
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally{
            if( bf != null ) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    } BufferedReader bf = null; bf null try{
            bf = new BufferedReader(new InputStreamReader(System.in));
            exec_body(bf);
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally{
            if( bf != null ) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            if( bf != null ) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        } if( bf != null ) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } bf != null bf null {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } IOException e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    bf.close();
                } bf.close() bf.close bf {
            bf = new BufferedReader(new InputStreamReader(System.in));
            exec_body(bf);
        } bf = new BufferedReader(new InputStreamReader(System.in)) bf new BufferedReader(new InputStreamReader(System.in)) exec_body(bf) exec_body bf public void exec_body( BufferedReader bf ) throws IOException {
            bf.readLine();
            int[] sAry = toList(bf.readLine(),false);
            bf.readLine();
            int[] tAry = toList(bf.readLine(),false);

            int cnt = 0;
            for( int tVal : tAry ) {
            		int left = 0;
            		int right = sAry.length - 1;
            		while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		}
            }

            System.out.println(cnt);
    } exec_body {
            bf.readLine();
            int[] sAry = toList(bf.readLine(),false);
            bf.readLine();
            int[] tAry = toList(bf.readLine(),false);

            int cnt = 0;
            for( int tVal : tAry ) {
            		int left = 0;
            		int right = sAry.length - 1;
            		while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		}
            }

            System.out.println(cnt);
    } bf.readLine() bf.readLine bf int[] sAry = toList(bf.readLine(),false); sAry toList(bf.readLine(),false) toList bf.readLine() bf.readLine bf false bf.readLine() bf.readLine bf int[] tAry = toList(bf.readLine(),false); tAry toList(bf.readLine(),false) toList bf.readLine() bf.readLine bf false int cnt = 0; cnt 0 for( int tVal : tAry ) {
            		int left = 0;
            		int right = sAry.length - 1;
            		while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		}
            } int tVal tAry {
            		int left = 0;
            		int right = sAry.length - 1;
            		while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		}
            } {
            		int left = 0;
            		int right = sAry.length - 1;
            		while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		}
            } int left = 0; left 0 int right = sAry.length - 1; right sAry.length - 1 sAry.length sAry sAry.length 1 while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		} left <= right left right {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		} int middle = ( left + right ) / 2; middle ( left + right ) / 2 ( left + right ) left right 2 int middleVal = sAry[middle]; middleVal sAry[middle] sAry middle if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			} middleVal == tVal middleVal tVal {
            				cnt++;
            				break;
            			} cnt++ cnt break; if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			} middleVal > tVal middleVal tVal {
            				right = middle - 1;
            			} right = middle - 1 right middle - 1 middle 1 if( middleVal < tVal ) {
            				left = middle +1;
            			} middleVal < tVal middleVal tVal {
            				left = middle +1;
            			} left = middle +1 left middle +1 middle 1 System.out.println(cnt) System.out.println System.out System System.out cnt BufferedReader bf bf public int[] toList( String str, boolean isBanhei ) {
            String[] elements = str.split(" ");
            int arysize = elements.length + ( (isBanhei) ? 1 : 0 );
            int[] ret = new int [arysize];
            for( int i = 0; i < elements.length; i++ ) {
                ret[i] = Integer.valueOf(elements[i]);
            }

            return ret;
    } toList {
            String[] elements = str.split(" ");
            int arysize = elements.length + ( (isBanhei) ? 1 : 0 );
            int[] ret = new int [arysize];
            for( int i = 0; i < elements.length; i++ ) {
                ret[i] = Integer.valueOf(elements[i]);
            }

            return ret;
    } String[] elements = str.split(" "); elements str.split(" ") str.split str " " int arysize = elements.length + ( (isBanhei) ? 1 : 0 ); arysize elements.length + ( (isBanhei) ? 1 : 0 ) elements.length elements elements.length ( (isBanhei) ? 1 : 0 ) (isBanhei) 1 0 int[] ret = new int [arysize]; ret new int [arysize] arysize for( int i = 0; i < elements.length; i++ ) {
                ret[i] = Integer.valueOf(elements[i]);
            } int i = 0; int i = 0; i 0 i < elements.length i elements.length elements elements.length i++ i++ i {
                ret[i] = Integer.valueOf(elements[i]);
            } {
                ret[i] = Integer.valueOf(elements[i]);
            } ret[i] = Integer.valueOf(elements[i]) ret[i] ret i Integer.valueOf(elements[i]) Integer.valueOf Integer elements[i] elements i return ret; ret String str str boolean isBanhei isBanhei public class Main {
    public Main() {
    }

    public static void main(String[] args ) {
            Main main = new Main();
            main.exec();
    }

    public void exec() {
        BufferedReader bf = null;
        try{
            bf = new BufferedReader(new InputStreamReader(System.in));
            exec_body(bf);
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally{
            if( bf != null ) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public void exec_body( BufferedReader bf ) throws IOException {
            bf.readLine();
            int[] sAry = toList(bf.readLine(),false);
            bf.readLine();
            int[] tAry = toList(bf.readLine(),false);

            int cnt = 0;
            for( int tVal : tAry ) {
            		int left = 0;
            		int right = sAry.length - 1;
            		while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		}
            }

            System.out.println(cnt);
    }

    public int[] toList( String str, boolean isBanhei ) {
            String[] elements = str.split(" ");
            int arysize = elements.length + ( (isBanhei) ? 1 : 0 );
            int[] ret = new int [arysize];
            for( int i = 0; i < elements.length; i++ ) {
                ret[i] = Integer.valueOf(elements[i]);
            }

            return ret;
    }
} public class Main {
    public Main() {
    }

    public static void main(String[] args ) {
            Main main = new Main();
            main.exec();
    }

    public void exec() {
        BufferedReader bf = null;
        try{
            bf = new BufferedReader(new InputStreamReader(System.in));
            exec_body(bf);
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally{
            if( bf != null ) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public void exec_body( BufferedReader bf ) throws IOException {
            bf.readLine();
            int[] sAry = toList(bf.readLine(),false);
            bf.readLine();
            int[] tAry = toList(bf.readLine(),false);

            int cnt = 0;
            for( int tVal : tAry ) {
            		int left = 0;
            		int right = sAry.length - 1;
            		while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		}
            }

            System.out.println(cnt);
    }

    public int[] toList( String str, boolean isBanhei ) {
            String[] elements = str.split(" ");
            int arysize = elements.length + ( (isBanhei) ? 1 : 0 );
            int[] ret = new int [arysize];
            for( int i = 0; i < elements.length; i++ ) {
                ret[i] = Integer.valueOf(elements[i]);
            }

            return ret;
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
 * 境界部分には気をつける(そこだけ別で処理するというのもあり)
 * 逆再生することで簡単になることもある
 */
public class Main {
    public Main() {
    }

    public static void main(String[] args ) {
            Main main = new Main();
            main.exec();
    }

    public void exec() {
        BufferedReader bf = null;
        try{
            bf = new BufferedReader(new InputStreamReader(System.in));
            exec_body(bf);
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally{
            if( bf != null ) {
                try {
                    bf.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public void exec_body( BufferedReader bf ) throws IOException {
            bf.readLine();
            int[] sAry = toList(bf.readLine(),false);
            bf.readLine();
            int[] tAry = toList(bf.readLine(),false);

            int cnt = 0;
            for( int tVal : tAry ) {
            		int left = 0;
            		int right = sAry.length - 1;
            		while( left <= right ) {
            			int middle = ( left + right ) / 2;
            			int middleVal = sAry[middle];
            			if( middleVal == tVal ) {
            				cnt++;
            				break;
            			} else if ( middleVal > tVal ) {
            				right = middle - 1;
            			} else if( middleVal < tVal ) {
            				left = middle +1;
            			}
            		}
            }

            System.out.println(cnt);
    }

    public int[] toList( String str, boolean isBanhei ) {
            String[] elements = str.split(" ");
            int arysize = elements.length + ( (isBanhei) ? 1 : 0 );
            int[] ret = new int [arysize];
            for( int i = 0; i < elements.length; i++ ) {
                ret[i] = Integer.valueOf(elements[i]);
            }

            return ret;
    }
}
