{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003ccenter\u003e \u003cspan style\u003d\"float:right\"\u003e \u003cimg src\u003d\"CDN_BASE_URL/287209ee67270c0ecf269a4924f2e37e?v\u003d1634981993\" alt\u003d\"\\includegraphics[width\u003d0.3\\textwidth ]{knob.png}\" style\u003d\"width:30.00%\"\u003e\u003c/span\u003e \n\u003c/center\u003e \n\u003cp\u003eDo you like golf? I hate it. I hate golf so much that I decided to build the ultimate golf robot, a robot that will never miss a shot. I simply place it over the ball, choose the right direction and distance and, flawlessly, it will strike the ball across the air and into the hole. Golf will never be played again.\u003c/p\u003e \n\u003cp\u003eUnfortunately, it doesn’t work as planned. So, here I am, standing in the green and preparing my first strike when I realize that the distance-selector knob built-in doesn’t have all the distance options! Not everything is lost, as I have 2 shots.\u003c/p\u003e \n\u003ch3\u003eTask\u003c/h3\u003e \n\u003cp\u003eGiven my current robot, how many holes will I be able to complete in 2 strokes or less?\u003c/p\u003e \n\u003ch3\u003eInput\u003c/h3\u003e \n\u003cp\u003eThe first line has one integer: \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e, the number of different distances the Golf Bot can shoot. Each of the following \u003cspan class\u003d\"tex2jax_process\"\u003e$N$\u003c/span\u003e lines has one integer, \u003cspan class\u003d\"tex2jax_process\"\u003e$k_ i$\u003c/span\u003e, the distance marked in position \u003cspan class\u003d\"tex2jax_process\"\u003e$i$\u003c/span\u003e of the knob.\u003c/p\u003e \n\u003cp\u003eNext line has one integer: \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e, the number of holes in this course. Each of the following \u003cspan class\u003d\"tex2jax_process\"\u003e$M$\u003c/span\u003e lines has one integer, \u003cspan class\u003d\"tex2jax_process\"\u003e$d_ j$\u003c/span\u003e, the distance from Golf Bot to hole \u003cspan class\u003d\"tex2jax_process\"\u003e$j$\u003c/span\u003e.\u003c/p\u003e \n\u003ch3\u003eConstraints\u003c/h3\u003e \n\u003cp\u003e\u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\leq N, M \\leq 200\\, 000$\u003c/span\u003e\u003cbr\u003e \u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\leq k_ i, d_ j \\leq 200\\, 000$\u003c/span\u003e\u003c/p\u003e \n\u003ch3\u003eOutput\u003c/h3\u003e \n\u003cp\u003eYou should output a single integer, the number of holes Golf Bot will be able to complete. Golf Bot cannot shoot over a hole on purpose and then shoot backwards.\u003c/p\u003e \n\u003ch3\u003eSample Output Explanation\u003c/h3\u003e \n\u003cp\u003eGolf Bot can shoot 3 different distances (1, 3 and 5) and there are 6 holes in this course at distances 2, 4, 5, 7, 8 and 9. Golf Bot will be able to put the ball in 4 of these:\u003c/p\u003e \n\u003cul class\u003d\"itemize\"\u003e \n \u003cli\u003e \u003cp\u003eThe 1\u003cspan class\u003d\"tex2jax_process\"\u003e$^{st}$\u003c/span\u003e hole, at distance 2, can be reached by striking two times a distance of 1.\u003c/p\u003e \u003c/li\u003e \n \u003cli\u003e \u003cp\u003eThe 2\u003cspan class\u003d\"tex2jax_process\"\u003e$^{nd}$\u003c/span\u003e hole, at distance 4, can be reached by striking with strength 3 and then strength 1 (or vice-versa).\u003c/p\u003e \u003c/li\u003e \n \u003cli\u003e \u003cp\u003eThe 3\u003cspan class\u003d\"tex2jax_process\"\u003e$^{rd}$\u003c/span\u003e hole can be reached with just one stroke of strength 5.\u003c/p\u003e \u003c/li\u003e \n \u003cli\u003e \u003cp\u003eThe 5\u003cspan class\u003d\"tex2jax_process\"\u003e$^{th}$\u003c/span\u003e hole can be reached with two strikes of strengths 3 and 5.\u003c/p\u003e \u003c/li\u003e \n\u003c/ul\u003e \n\u003cp\u003eHoles 4 and 6 can never be reached.\u003c/p\u003e \n\u003ctable class\u003d\"sample\" summary\u003d\"sample data\"\u003e \n \u003ctbody\u003e\n\u003ch3\u003eSample Input\u003c/h3\u003e \n \u003cpre\u003e3\n1\n3\n5\n6\n2\n4\n5\n7\n8\n9\n\u003c/pre\u003e \n \u003ch3\u003eSample Output\u003c/h3\u003e \n \u003cpre\u003e4\n\u003c/pre\u003e \n \u003c/tbody\u003e\n\u003c/table\u003e"}}]}