#include
<
iostream
>
using
namespace
std;
int
N,M;
int
a[
15000
];
int
main()
{
scanf(
"
%d
"
,
&
N);
for
(
int
i
=
0
;i
<
N;
++
i)
scanf(
"
%d
"
,
&
a[i]);
int
s
=
0
,x;
scanf(
"
%d
"
,
&
M);
while
(M
--
){
scanf(
"
%d
"
,
&
x);
int
l
=
0
,r
=
N
-
1
;
while
(l
<=
r){
int
mid
=
(l
+
r)
>>
1
;
if
(a[mid]
==
x)
break
;
else
if
(a[mid]
>
x) r
=
mid
-
1
;
else
l
=
mid
+
1
;
}
if
(l
<=
r) s
++
;
}
printf(
"
%d\n
"
,s);
return
0
;
}
posted on 2009-05-31 00:50
xfstart07 阅读(124)
评论(0) 编辑 收藏 引用 所属分类:
代码库