//experimental(sabbat of the witch)
//compiledef
#include <bits/stdc++.h>
#define rep(i, n) for(i=0;i<(n);i++)
#define per(i, n) for(i=(n);i>0;i--)
#define repx(i, n, x) for(i=(x);i<(n);i++)
#define xper(i, n, x) for(i=(n);i>(x);i--)
#define pback push_back

//c++def
using namespace std;
typedef long long int ll;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
bool binarysearch_alt(int *a, int key, int n_a){
	int o=0;
	int n=n_a;
	while(abs(o-n)>1){
		int m=(o+n)/2;
		if(a[m] <= key)o=m;
		else n=m;
	}
	if(a[o]==key) return true;
	else return false;
}
int ans;
int main(){
	int n1, n2; int a[100001]; int q[50001];
	int i; int j;
	cin >> n1;
	for(i=0;i<n1;i++){
		scanf("%d", &a[i]);
	}
	cin >> n2;
	for(i=0;i<n2;i++){
		scanf("%d", &q[i]);
	}
	for(j=0;j<n2;j++){
		if(binarysearch_alt(a, q[j], n1)){
			ans++;
		}
	}
	cout <<ans<<endl;

}




/*   
	 `` __~~~~:::: ` ~~(<!__   `            ``````````.``.`.`````        `  ``  ........((J+&zzwwuZZZXUUUUTYYYTTTT7771<>1+z _.~:_..~...``               `` `` `   `
	 ````````````` `                `    ``.  .........---_(((;;;.;;;;<<<<<<<<<<<<<<~_~~~~~_________:::<<<<<<<++(.(J _~~_~~~......```              `` ` ``` ``` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `
	 ``                       ..~~~~~~::;>;<<<<<<<<!!!~~~_`` ``` (.`````..`___..______~_-((((JJ+&&swwXUWWWHHWfWkkkkR ~~:(:~~~..~....``` `     `      ` ` ` `  `` `` `  ` ` ` ` ` ` ` ` ` ` ``` ``
	 ``.........~~..:<.__````              ````````````````````````  .......((((++zzvOOOOOtttttttOZVX0XXZZyyyyWUUUUUYY=.<::<:~~~~.~......````` `  ` `    ` `` ``  ``  ` `` ` `  `        ` ` `  ` `
	 `           ````` `` `` `                  `    .......-(((+++??+1111,?++<;>?==zzz11<<<<<<<+++z<?<<<<<;<~~___~~~~~::~::~ (;>+><~~~~.~~.....```````    `     ` `` `` `` `` `` `` ` ``` ``` ` `` `` ` `
	 `` `  `  `      .......____:~:~~<<<<<::::;;;;<<>>>>???=====?<<;;<<<<<++1=zztwOtI<::::::::::;;;;<--.~~~:::::~ (>?z?<::~~~~.~~......```````` ``     ` ._-Jzi.`` ` ` `` ` ``` ``` ` ` ` ` ``
	 `` `` `    .-.~..______~~~~~~~~~~~~~~~~~~~~~~~:::;;:;<<<<<<<<!~~_``` ````  .(z<<<:::+1zI<::::;:;:;;::;<<+;:;?i-~~:;;>~ (?1z=?<:::_~~~~~~~.....```````````` `   .zz1XI-`` ``` `` `  ``  `` ` ``` ``
	 .```````````````...-..~~.~.~.~~~~~~~~~~__~~____```    `````````````````````` .Jlz?1++++<+jtI::;::;:;:;::;::::;<<;;;?1+~<;>~ (=zOl=?<;::~~~~~~~~.......`````````` - .<~~.(O<`````````````````````` ` ````
	 .. `   ` ```````.....____````    ````` ` `````` ``` ` ` `` -_:_-. ` ` ...` .wZlllzzz+<+wwOttlz<;::;:::;:;:;;;:;;;;<<:?vo(<~ (ltwtlz?+>;:::~~~~~~~~...............-_(<(JgMHM-````````````````` ``````` ``
	 .._  `  `           ``` ` `````` `` ````` `` ``` ````` ` ._~~::::1iCJ+?VdkXwwOCC7zOz+jXwXOC7<<;;;::;:;;;:;;;:;;:;;;<?&<Ouo_ (tvwvrl==?<;;::::~~~~~~~~....(qkkkkkRd<+<(dHHHM[````````````````````````````
	 `` `           `  `  ` ``` `` ``````````````````` ` ``  _:(+tttww6xzXkXWSwzz+;;;;:;?wXuwZV77<<<<;;;;;;;;;;::;;:;;;;;;;XnvXX.(Orwzvrttz=?+<;;:::::~~~~~~~.JqqmmqqHMr(AdHHH@@]````````````````````````````
	 `` ``              ` ``` `````` ```` ````````````````.(!.lz<+wwlz2WWX8vzzww&&&&uuwwXVC<:::;:::;;;;;;;?1z+<;;;;;<(<;;;;?WWkzw+zwZZZOOOOI==1++<<::::~~~~~~dkmmmmqHMNdHMHHHH@].......`.```````````````````
	 `` ```    ` `  `   `  ```` ````````````````````````.J! zI(xzXUOktwVGwwkkY1<;;;;?7C;;;;;;;:;:;;:;:;:;;:;;?TXw+<<<;1&<;;<4WWwrx<<<<<<<<<<<<<<<:~~~~~~~~~(HbbbHqmH##M#HHHHM@$................`.``.``.````
	 `` `````   `  ` ` `` `````````````````````````````.O!`.>(zwZv++wbdXuXV>;;;;;;:;;;;;;;;;;;;;;;:;;;:;;;;;;;;<?4ZyA+<;vkx<;vyWkro____~~~~~~~~...~.~......(kbbbkmqp#HHHHHM@@@k___----................`..`.
	 `` ` ````   ` ` `` `` `````````````````````````` +:``(+OZ>w(bkHNXUV>;;;:;;:;;:;:;;<++zOwA&++;:;:;:;:;:;:;;?1/TZyyk&?WWX&?XZXXO.`     _     `` ....` (dkWWkkHqW###MMNMNMNNP._```_...__((J&_.........`.
	 ```` ```` ` ` ` ` `````````````````````````.```(v```(Ow>XQWH#XKw3;;:;;;:;;;;;:;;:;;:;;;;;;<?C+<;;;;:;;;:;;_zAJOZyyykdHWHaZuuZw/_~::::__-.....__!<<1d###H#MMHNMNMMMMMMMM9>  ...Jxwzvvzuzz<..........`
	 `````````` `` `` `` ````````````````.`.`.`.`.=>`..OwZjJXUWd9d>;:;;:;++<<:;;;;:;;;;:;;;;;;;;;;<<;;;;:;;;;<(?UykZWyyyWHkWHWXuzZl~~~~~~~~~~~~~~~~~_~<<??7TYYHBMB9T711+J&wuuuXXzuzuzzzzuuX>~~.~.......
	 `   ` ```````````````````````````````.`.``.`...`.(=>``.(tzwVwuJ6Z>+;;;;+z<;;:;:;:;;;:;;;;;+;;;;;;;;;;;;;;<(;;;;;+?WkuXUyyWWkWWZXXXOn-_~~~~~~~~~~~~~~~~~~~~~~~~~:(<<duuuZuZZZuuuuuuzzuzzuuuZz~~~~~~.....
	 ` ` ````````````````````````````..`.`......`..`.(?< `((wwV;uX1X1v;;:;<<;;;:;;;;;;;;;;;;;;+z+;;;;<;;;;<<~;;;;:;;;1+UHkkzzUUWkWZuuXXyvo..................~~~~~~~<~~~zuuuZXuuuuuuuuuuuzuzuuz0?_~.~.~~~~~.
	 ` `  ````````````````````````.`.`..`.`.`...`...`?>< (t13;jX1XIZ;;:;;;;;;:;z;;;;;;;;;;;;;;1wo;;;<1<-(__1<;;;;;;;;OkJWWyyXwwwZUXwuuWWWmw+...``...............~_~~~~zuuZXuuuuuuuuuuuuuuuuuu0?<~~~~~~.~~~
	 ` ` `` `````````````````````..`.`..`...............(zzj0;+O{w&Z;;;<(;;;;;;jI+<;;;;;;;;;;;++zOI+(;;O+<;;;Ox;:;;;;;>wykXUyyZZZWyWuZuuXXHpWUOzz1+.``........-_~~~~~..wuuuuuuuuuuuuuuuuuuuuuuI?>:~~~~~~~.~
	 ` ` `` ````````````````````.`.`....`.................<;jSI+>zdXP_(:;(;:<_(((wI+c<<<<<:;;;;;<X+Xzzo;;<Xyo;;;Xo;;;:;;(cWyXXzZUZZyWyuXOwuWuc?1+!``_CO<. ...__...~.~~_..wuuuuuuuuuuuZZuuuuZZZZZI??<:~~~~~~~~
	 `` ```````````````.``.`......`..`..................(<<+wu1>+wXK>;;;jI;;;;;;JzRjR;;;;;;;;;;;;wXxWzzG+;?UkX+;<Xo;;;;;;XJyZWkXzvXXkykukwXdXO>++-` .jv<<!~`````` __~~<. uuuuuuuuuuZZZZZZZZyyyyyI??<:::::~~:~
	 ```````````````..`.....`..`....................~.._(;((rwI+wuX$;;;;d+;;;;;+zuRjW<;<<;;;;;;;;duXvSzuux;zXkXo>?W2;;;;;dkXZuXWHmAwrZWuVXuwZZI??c+<<::!`````````````_~..uuuuuuuuZZZZZZZZZyyZyyZz=?=<;:::::::
	 ``````````````..`..`........................~.~~.(>><!-rX;dzXH+;;;jkz;;;;;JzuHzXI;>j<;;;;>;>wzuXXXzzuc<XXWZn<zy+>;>>jydZZuZHkyyWkQAwzXUXZkz1X<;:~````.```.``.````` _OwuuuzwuuZyyZZZyyyyyyyZl===z>;:;:::;
	 ````````````..`..........................~~~.~~.~(zz<.~?$jKXW0k;;;dSw;;;;+uuuXIXR+;<S<;>;;><wzuXzZzuzzczu0Xuk+ZS>;;>+ykZZuuXHVyZXdHXbWXyZ$>d0<<!`.....----..... `````_7rvrvvXZZyyyyyVVVVffZl===??<>;;>>+
	 ``````````..`..`....................~.~~.~.~~~~~~.jZ_~~(IXSXHXWc;;XSy>;;;juzzrkwXk>;?R+;;;;juuzuuXwzzzzzuuOXXXwX2>;;+ySZZZuXmWyyXXmWkHHyXIwXC<<;<juOI<!____~!<<<><--.`` ?OzwJZyyyyVVVfffffXrOlll=?????1=
	 ....`......`....`..............~.~~.~~.~~~~.~~~~~~(I~~~(XWzXHdyk;+WkyI;;;dZzzlXwuSO;;dXc;>;JuXzwzzZOvwvwvvIzzXuZk>>;+yyZZZuupHVXWWHqkHWWHUX3>+xVC<<`````````````. _++><-.`_1uZyyyVVfffWUUVwwzwwwwyzzzzzl
	 `..`....`.................~~~~~.~~.~~.~~.~~~~~~~~~~I~:~(IXwWWXyZ<jWkZX<;>wZuzlzuuuuI><Wzo;>wvdvvXrIzwwUrrrr?zrzuX2;>+yyZuuuuWWkyWWWkkHW8dXZzZ1+++&z+((++++zwwwXmAAAQQaa&&z+..7XyyffWWXQQkWWHkWkkQQmXwzvz
	 .`....................~~~.~~.~~~~.~~~~~~~~~~~~~~~::j_:::1wwXWZZyIjSZZZI>+uuuzv<XXuXuO;?Szw+vrw0rwwZC(Ozttttc<jtOXb>;jZZZuuuuyWWVfZHkHY1dUVC1>>>>>>>>>>???????????zvUWfVfWVWWA+.?WXWWmqqqqqqqkqkkkkkkkkkq
	 ..`................~~..~~~.~.~.~~~~~~~~~~~~~~~:::::(z:::(zwuWZZZZdkXZuuc+uuwvI<(vXvXzA+?wrvrwwSVOtl>_<z?lllz;_1vwS;>duZZuuZuyXbWWXg91u1>>>>>>+++++++??>?>?????????????OUWyyXXuUy+?UHqkqkkkkkkbkkkkkkkkkk
	 .................~.~~~~.~~~~~~~~~~~~~~~~~~~:::::::::?z(:+zrrWXuZZXRuuuuX+zuZvI+.jwwwuOr+?OttttVll1l<! =:(===:~.Oju>>wuuuuuXzWXkHWW3+zI>+&uwXZUUUUXXvrtll===??????????????zXUZZXzXwz(<7Wkbbkbkkkkkkkkkkkk
	 ...........~.~~~~.~.~~~~.~~~~~~~~~~~~~~::::::::::::::<1z1zlzjXuuZZWvuzzzkvzwzO<_ jZttZytO?OlllOlz+?<~`(<_<?=<~`(<X>juzuuuzXXHXqHVuZOvXVYC<??++11zzzOll====?????????????????zwuZZXrww+<+?Wbbppppppppbbbbb
	 ........~~~.~~.~~~~~.~~~~~~~~~~~~~:~:::::::::::::::;;;<<<<+;+uZuuuXrwXzzwuvvIO>~  1?llvwl=+I=lv?<(?<~` :_ <?<_` >(>zzzzuzwXXHWHSwXzVC>>>>>>>>>>>>>>>??????????????????????1zrzuuuuAzz1<?OXbbkkbbbbbbbbpp
	 .....~~~.~.~~.~~.~~~~~~~~~~~~~:~:::::::::::::::::;<++&zu&++z;wZuuuZIzkvrrWvrw(O__` 1(1lzGz??zv<?<(>~__ ((<.<<> ..JjkvvzzzwRWHHWXZ1>>>>>>>>>>>>>>>?>>?>??>????????????????ztrrvvzuuuuO+><<?Xbbkkkkkbbkbbb
	 ..~.~.~~.~~~~~~~~~~~~~~~~~~~::::::::::::::<+++uuwwXXXXXXWWWW0zXkuuuXrXwrzXHrrI?>_ ` >_<=?zO+?><>< <~`.a(+gHMMH##MKw0rvvOZdXHHKC>>>>>>>++??????>>?>?>>??>???????????????zltttrvzvrrvzzux;;:(4bbbbbbbbbbbb
	 .~.~.~.~~~.~~~~~~~~~~~~~~:~:::~::::+++&dXkXXXXyVVyyXUUUWWWUf>jdmkuuuXZHrrZHWOt:(-_ ..(-??>>11<>>- !_`(XHMMM#MMHBYXXrrvwzwHqHY>>>;>>+zll==??>>>?>>?????>???>????????1zlttttOvvrrrrrwuuuuG+::</UHkkkkkkkkb
	 ~.~~~.~~~~~~~~~~~~~~~::~:::((++edkWpbbkkkbppffffY!````.._:z<<jKWWwzuuwXRttXyWyz_.gggHH@Hr~<<<!(<;;-`` !!```.```.JZOrrrvuXq91>>>>+xtttOOz<>>>>>?>??>?????????????1zOrtttrwwwrrrrrwzuuuuuuuo<::_?THkkkkkkq
	 ~~.~~~~.~~~~~~~~~::((J+uwwXZyVfpbkkkkkkkkkpppW=`..-(<<<<11z;<dWXpkwXXZwWktZWuXkojHMMMHB"=` ~!`   <<<-.`...... .(I;zwrrwXH61>;++rrwwZC1>>>>?>?????????>???????zzwwrrrrwwX0rrttrwwuuuZXXuuuuX+::_.<4kkkqkq
	 ~.~~.~~~~~~_((JxwwXXXVyyyyyyVVVfppbkkkkqkH9Y=~```````_~~~<u(;r?TUpkOdXZwZStduuuXI.``.``````` ```````_~<__.....(>:(j0rwX3~_.._~!!`   `?<<>>?>??>??????????1zzwXUzvvwwWWXuwwwXZZuZZuZX0uzzuuuXo(:~.~4qkkqk
	 ~~~~-((+uwwXkXpfVyVfffVVyyVVVfffppppVY!   ` ``    --.... `(w;z>;?WWWwWkuZXwOXzzvv/!.....``````` ` ````.`.....(<~~jXv7"!``               ` _?<<????????zzwXXWUuuXXWHWXyXUUUUuuuZZZZ0zvvzzzuuuzw+::_.4qqqq
	 uswwkXWfppppppppffWpppfffffffffffV=~```` `` ````...~~~((<<<X2(z++xdkWkWkuXXvwXrrrr-....``````` ``` `````````-~~(J{           ` ` ``` `` `` ` `   ~?1OzuXWWZuuXkgHHWZZuuuzzuXXyUUvrrrrvzzzzuuuuXz_:<.?kqq
	 kkqkWbbbpppppppppfppbbpppfpffVY!..      `  ` `````  ` `````.4oI--(+1XXZWbkzzzXwrttt1.``````` ``` `` `` ``` .~(uWr~_____(<<<<<<~~~..`````` ` `` .-:::<+z+z74XHHkHyyyyZXXZXUUuzvvzvrvvvvvzzzzzuzuGz<:(-.Wk
	 kkkppbpbbppbbbbpffppbbpppWY=~``      `  ` `` ` ```````````..(Xy+>;;>>rZUkXXkwrZXOllll4a,. ``` -. `` ``` ` -(MNN#~_~`       ```__``     ` ` .._:::<<<;;;+udqqqqHWWWWWXuuuuuuzzzzzuzzzzzuuzvvvvvvvvwo_:<.C
	 kkkkbbppppppppppWWpkHKY=!`         `  ` ` ` ` ````````` .(;;;<OX+;>;+ttI1ggSvXXyUms===zTMNMmg...`` ` ``.(g#N##:~~-.               ` ` .._:::+<;<<;;;>ugHHHHHbHyyyZZZuuuuuuuuuuzzzuuuuzvvvvrvvvvvvvvwx-:_
	 qHqkqkbbpbppppppWV7^`             `  `   ` ` `` ```` .(;:;;;;;;?Xx>>zAgM###wrdMHNkMHHax?1TMH@@@@@mg...dHHHH#3((-___~~__.........-__:(((+<<<<::;;;;jgHHHHdbppWyyyyyZZZZZZuuuuuuZZZuuzzzvvvvvrvvvvzzzuXWko
	 qqqmqqqqqqkbWY=`           `  `  `    ` `  `` ` ` .(::;::;;;;;;;;?WUMMMMMBwgMHH@HH@HH@@HMHmmW@@@@@@@H"^`           ` `     ``````````___:::::;;+&WWWWqWHRWkkbpfffffVVVyyyyyZZZZuuzzzzzzXwzwwwXuuuuuuuXWZ
	 qqqqHYUHY=!.``.             `      `   ` `  ` .-::::::;:;;:;;<<(d@HHMHHHHHHH@@MMMMMMHHHqHHqHHM@@@@@M=.                      ....._~~:~::::::<jdWUXQQQHHHHHkdWpfffffVVyyyyyyZZZuuzuuuXXkWWWWXZuuXzzzuXWUX
	 "^~._-.     ``_-___.          `  `  ` ` ` .-::::::::;;<;;<<_(d@@@@@@@MMMHHkkkkkkkkkbbbkkkkkkkkkkHM@~-(<<<!<~-.           _~~~~~~~~~:~::~::jdWQQHHH@@@MHHHHWWkwXWWVfVVVyyyZZZZZuuXXWWWUUUUXXzzzzzzzXXW0Ot
	 ....`.....             `  .  .-_~~~::((((((+<<<+++z<<<<:(Jd@@@@HMHppppppbbkkkkkkkkbkkkkkbbkbWY""?`           _~<-.       ~~~~~~~~~:~:::(&HHH@@@@HHHHWVyVVVVVVVVyyyyyyZXUZyZXXkpHWuuuuuzzzzzzuwwXkWW0Zttt
	 ```````````   `                 `   ..(:::::::::::<:(JgH@@ggHHppppbppppppppppbbkkkkkkkkkkkkf_-_-..             _~<<_.   ~~~~~~~~~:~:((HHMMMgHHHVyyyyyyyyyyyyyVVVVVfVyyXuuZZuXUZZZZZuuuuuuXXXWHpWW0Zttltr
	 			   `.~~:~:::~::~:::::;;<+++gH@@@@HHHpppppppppppbppppppppppbbHbkbbHY!``__..`````           _~<~_. ~~~~~~~~:~(dWH@@@HHfVVyyVyyyyyyZyyZyyyyyyVVVVVVyyZZZZZuuZuXwXuZyWWkWWUUZOttttrvw
	 		    	 .._~~~~:~~:::::;>>1ugkggg@@HHHHppbkkWbpppppppppppppbpbbppppbppY^         `     `          __~~~~~~~~~~~(JHHNmkXWHpppVVVVyVVyyyZXUUVVTTTTUUUUUWyyyyyyyZZZZZZuZZZZZXXwwrrttttOrwwf
	 		    ..~~~~~~~~:~:~:~~~_(JgggggggHHHHVffffppbbkbbbbbbppppppppppbbpbbbV=                         .-.  _~~~~~::~_(d@@@HHHHWHHppHHHHHHyyWWWWyyWWWWA&+>;;?THkkXZyyyyyyyZyZyyWXyyZZZZZXXwwZUUWW
	 		 .~~~~~.~~~~~~~:~_(JdgggggggHHHWVVyVVVffffpppWHbkbbbkkkWbppbppppppY!                         _.~~~~..~~~~~~(+@@@HHHHWVffVVVyyyyyyyyyyyyyZZZZyyZZZWo;;;?UWyykyyZyyyyyyyyVVyVVVffWWXZZZZXww
	 	      -~.......~~~~~~((+WmmmmqqqHHHbbHffVyVVVVfffffpppppppbbbbbbbbkkkbbWY~                         -..~.~~.~~~~~-(W@@gmqHHyyyyyyyyyyyyyyyyyyyyyyyyyyyZZyZZXh_>+vwWUXyyyyyZyZZyyyyyyyyVVyVffpfWXZZ
	       ``  .......~..~~~~_(+WgmmgmqHHHfffffffWVffffffffffpfpfpppppppbbbbbbbbbK=_`                         ~.~~~~.~~~~~(d@@HHgmHHfVyyyyZyyZZZyZZyyyyyyyyyyyyyyyyyyyyXI;jrwXXZZyyyyyyyyyZyyVyyyyyyyyVVffffV
	       .........~.~~~~(JdgggmmmHHbfffffffffffWyVVVfpppfffffppfffppfpppppbbbK=_                          -~~.~~.~~~~(JW@@@ggHHffffVVVVVyyyyyZZZZZZZZZZyyyZyyyyyyyWWAsz+OwWZZZuZZZZZyyyZyyyyyVVyyVyyVyyVVff

 */


Measured memory_bytes: 3728