import java.io.*;

class Main {
    public static void main(String[] args) {
        try {
        	BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
        	int n = Integer.parseInt( kb.readLine( ) );
			String[] str = kb.readLine( ).split( " " );
			int[] S = new int[ n ];
			for( int i=0; i<n; i++ ) {
				S[i] = Integer.parseInt( str[i] );
			}

        	int q = Integer.parseInt( kb.readLine( ) );
			str = kb.readLine( ).split( " " );
			int[] T = new int[ q ];
			for( int i=0; i<q; i++ ) {
				T[i] = Integer.parseInt( str[i] );
			}

			int cnt = 0;
			int low, high, middle;
			for( int i=0; i<q; i++ ) {
				low = 0;
				high = n-1;
				middle = n/2;
				while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				}				
			}
			System.out.println( cnt );

        } catch( IOException e ) {
            System.err.println( e );
        }
    }
} import java.io.*; io.* java class Main {
    public static void main(String[] args) {
        try {
        	BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
        	int n = Integer.parseInt( kb.readLine( ) );
			String[] str = kb.readLine( ).split( " " );
			int[] S = new int[ n ];
			for( int i=0; i<n; i++ ) {
				S[i] = Integer.parseInt( str[i] );
			}

        	int q = Integer.parseInt( kb.readLine( ) );
			str = kb.readLine( ).split( " " );
			int[] T = new int[ q ];
			for( int i=0; i<q; i++ ) {
				T[i] = Integer.parseInt( str[i] );
			}

			int cnt = 0;
			int low, high, middle;
			for( int i=0; i<q; i++ ) {
				low = 0;
				high = n-1;
				middle = n/2;
				while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				}				
			}
			System.out.println( cnt );

        } catch( IOException e ) {
            System.err.println( e );
        }
    }
} Main public static void main(String[] args) {
        try {
        	BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
        	int n = Integer.parseInt( kb.readLine( ) );
			String[] str = kb.readLine( ).split( " " );
			int[] S = new int[ n ];
			for( int i=0; i<n; i++ ) {
				S[i] = Integer.parseInt( str[i] );
			}

        	int q = Integer.parseInt( kb.readLine( ) );
			str = kb.readLine( ).split( " " );
			int[] T = new int[ q ];
			for( int i=0; i<q; i++ ) {
				T[i] = Integer.parseInt( str[i] );
			}

			int cnt = 0;
			int low, high, middle;
			for( int i=0; i<q; i++ ) {
				low = 0;
				high = n-1;
				middle = n/2;
				while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				}				
			}
			System.out.println( cnt );

        } catch( IOException e ) {
            System.err.println( e );
        }
    } main {
        try {
        	BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
        	int n = Integer.parseInt( kb.readLine( ) );
			String[] str = kb.readLine( ).split( " " );
			int[] S = new int[ n ];
			for( int i=0; i<n; i++ ) {
				S[i] = Integer.parseInt( str[i] );
			}

        	int q = Integer.parseInt( kb.readLine( ) );
			str = kb.readLine( ).split( " " );
			int[] T = new int[ q ];
			for( int i=0; i<q; i++ ) {
				T[i] = Integer.parseInt( str[i] );
			}

			int cnt = 0;
			int low, high, middle;
			for( int i=0; i<q; i++ ) {
				low = 0;
				high = n-1;
				middle = n/2;
				while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				}				
			}
			System.out.println( cnt );

        } catch( IOException e ) {
            System.err.println( e );
        }
    } try {
        	BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
        	int n = Integer.parseInt( kb.readLine( ) );
			String[] str = kb.readLine( ).split( " " );
			int[] S = new int[ n ];
			for( int i=0; i<n; i++ ) {
				S[i] = Integer.parseInt( str[i] );
			}

        	int q = Integer.parseInt( kb.readLine( ) );
			str = kb.readLine( ).split( " " );
			int[] T = new int[ q ];
			for( int i=0; i<q; i++ ) {
				T[i] = Integer.parseInt( str[i] );
			}

			int cnt = 0;
			int low, high, middle;
			for( int i=0; i<q; i++ ) {
				low = 0;
				high = n-1;
				middle = n/2;
				while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				}				
			}
			System.out.println( cnt );

        } catch( IOException e ) {
            System.err.println( e );
        } catch( IOException e ) {
            System.err.println( e );
        } IOException e {
            System.err.println( e );
        } System.err.println( e ) System.err.println System.err System System.err e {
        	BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
        	int n = Integer.parseInt( kb.readLine( ) );
			String[] str = kb.readLine( ).split( " " );
			int[] S = new int[ n ];
			for( int i=0; i<n; i++ ) {
				S[i] = Integer.parseInt( str[i] );
			}

        	int q = Integer.parseInt( kb.readLine( ) );
			str = kb.readLine( ).split( " " );
			int[] T = new int[ q ];
			for( int i=0; i<q; i++ ) {
				T[i] = Integer.parseInt( str[i] );
			}

			int cnt = 0;
			int low, high, middle;
			for( int i=0; i<q; i++ ) {
				low = 0;
				high = n-1;
				middle = n/2;
				while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				}				
			}
			System.out.println( cnt );

        } BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) ); kb new BufferedReader( new InputStreamReader( System.in ) ) int n = Integer.parseInt( kb.readLine( ) ); n Integer.parseInt( kb.readLine( ) ) Integer.parseInt Integer kb.readLine( ) kb.readLine kb String[] str = kb.readLine( ).split( " " ); str kb.readLine( ).split( " " ) kb.readLine( ).split kb.readLine( ) kb.readLine kb " " int[] S = new int[ n ]; S new int[ n ] n for( int i=0; i<n; i++ ) {
				S[i] = Integer.parseInt( str[i] );
			} int i=0; int i=0; i 0 i<n i n i++ i++ i {
				S[i] = Integer.parseInt( str[i] );
			} {
				S[i] = Integer.parseInt( str[i] );
			} S[i] = Integer.parseInt( str[i] ) S[i] S i Integer.parseInt( str[i] ) Integer.parseInt Integer str[i] str i int q = Integer.parseInt( kb.readLine( ) ); q Integer.parseInt( kb.readLine( ) ) Integer.parseInt Integer kb.readLine( ) kb.readLine kb str = kb.readLine( ).split( " " ) str kb.readLine( ).split( " " ) kb.readLine( ).split kb.readLine( ) kb.readLine kb " " int[] T = new int[ q ]; T new int[ q ] q for( int i=0; i<q; i++ ) {
				T[i] = Integer.parseInt( str[i] );
			} int i=0; int i=0; i 0 i<q i q i++ i++ i {
				T[i] = Integer.parseInt( str[i] );
			} {
				T[i] = Integer.parseInt( str[i] );
			} T[i] = Integer.parseInt( str[i] ) T[i] T i Integer.parseInt( str[i] ) Integer.parseInt Integer str[i] str i int cnt = 0; cnt 0 int low low high high middle; middle for( int i=0; i<q; i++ ) {
				low = 0;
				high = n-1;
				middle = n/2;
				while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				}				
			} int i=0; int i=0; i 0 i<q i q i++ i++ i {
				low = 0;
				high = n-1;
				middle = n/2;
				while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				}				
			} {
				low = 0;
				high = n-1;
				middle = n/2;
				while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				}				
			} low = 0 low 0 high = n-1 high n-1 n 1 middle = n/2 middle n/2 n 2 while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				} low <= high low high {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				} if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					} T[i] == S[middle] T[i] T i S[middle] S middle {
						cnt++;
						break;
					} cnt++ cnt break; if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					} T[i] < S[middle] T[i] T i S[middle] S middle {
						high = middle - 1;
						middle = ( low+high )/2;
					} high = middle - 1 high middle - 1 middle 1 middle = ( low+high )/2 middle ( low+high )/2 ( low+high ) low high 2 {
						low = middle + 1;
						middle = ( low+high )/2;
					} low = middle + 1 low middle + 1 middle 1 middle = ( low+high )/2 middle ( low+high )/2 ( low+high ) low high 2 System.out.println( cnt ) System.out.println System.out System System.out cnt String[] args args
import java.io.*;

class Main {
    public static void main(String[] args) {
        try {
        	BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
        	int n = Integer.parseInt( kb.readLine( ) );
			String[] str = kb.readLine( ).split( " " );
			int[] S = new int[ n ];
			for( int i=0; i<n; i++ ) {
				S[i] = Integer.parseInt( str[i] );
			}

        	int q = Integer.parseInt( kb.readLine( ) );
			str = kb.readLine( ).split( " " );
			int[] T = new int[ q ];
			for( int i=0; i<q; i++ ) {
				T[i] = Integer.parseInt( str[i] );
			}

			int cnt = 0;
			int low, high, middle;
			for( int i=0; i<q; i++ ) {
				low = 0;
				high = n-1;
				middle = n/2;
				while( low <= high ) {
					if( T[i] == S[middle] ) {
						cnt++;
						break;
					} else if( T[i] < S[middle] ) {
						high = middle - 1;
						middle = ( low+high )/2;
					} else {
						low = middle + 1;
						middle = ( low+high )/2;
					}
				}				
			}
			System.out.println( cnt );

        } catch( IOException e ) {
            System.err.println( e );
        }
    }
}