{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cp\u003eA sequence is called nice if its elements are distinct consecutive numbers, possibly in changed order. For example, both (6, 7, 8) and (15, 13, 16, 14) are nice, while (4, 6), (4, 5, 5, 6) and (15, 16, 15) are not.\u003c/p\u003e \n \u003cp\u003e Limak has a nice sequence. While he was in school today, someone inserted one extra number in the sequence. Limak has just returned and realized that the sequence isn\u0027t nice anymore! He wants to remove the inserted number and make his sequence nice again. Can you help him to find the number that he should remove? \u003c/p\u003e \n \u003cp\u003eFormally, in each test case you are given a sequence of \u003cb\u003eN\u003c/b\u003e numbers \u003cb\u003eA\u003c/b\u003e\u003csub\u003e1\u003c/sub\u003e, \u003cb\u003eA\u003c/b\u003e\u003csub\u003e2\u003c/sub\u003e, ..., \u003cb\u003eA\u003csub\u003eN\u003c/sub\u003e\u003c/b\u003e. Your task is to find the value \u003cb\u003eX\u003c/b\u003e, such that removing one occurrence of \u003cb\u003eX\u003c/b\u003e would make the sequence nice. It\u0027s guaranteed that exactly one solution exists.\u003c/p\u003e \n \u003ch3\u003eInput\u003c/h3\u003e \n \u003cp\u003eThe first line of the input contains an integer \u003cb\u003eT\u003c/b\u003e denoting the number of test cases. The description of \u003cb\u003eT\u003c/b\u003e test cases follows.\u003c/p\u003e \n \u003cp\u003eThe first line of each test case contains an integer \u003cb\u003eN\u003c/b\u003e denoting the size of the new sequence.\u003c/p\u003e \n \u003cp\u003eThe second line of a test case contains \u003cb\u003eN\u003c/b\u003e integers \u003cb\u003eA\u003c/b\u003e\u003csub\u003e1\u003c/sub\u003e, \u003cb\u003eA\u003c/b\u003e\u003csub\u003e2\u003c/sub\u003e, ..., \u003cb\u003eA\u003csub\u003eN\u003c/sub\u003e\u003c/b\u003e denoting the new sequence.\u003c/p\u003e \n \u003ch3\u003eOutput\u003c/h3\u003e \n \u003cp\u003eFor each test case, output a single line containing one integer — a number that should be removed from the given sequence.\u003c/p\u003e \n \u003ch3\u003eConstraints\u003c/h3\u003e \n \u003cul\u003e \n \u003cli\u003e\u003cb\u003e1\u003c/b\u003e ≤ \u003cb\u003eT\u003c/b\u003e ≤ \u003cb\u003e10\u003c/b\u003e\u003c/li\u003e \n \u003cli\u003e\u003cb\u003e3\u003c/b\u003e ≤ \u003cb\u003eN\u003c/b\u003e ≤ \u003cb\u003e10\u003csup\u003e5\u003c/sup\u003e\u003c/b\u003e\u003c/li\u003e \n \u003cli\u003e\u003cb\u003e1\u003c/b\u003e ≤ \u003cb\u003eA\u003c/b\u003e\u003csub\u003ei\u003c/sub\u003e ≤ \u003cb\u003e10\u003csup\u003e9\u003c/sup\u003e\u003c/b\u003e\u003c/li\u003e \n \u003cli\u003eThe given sequence isn\u0027t nice.\u003c/li\u003e \n \u003cli\u003eThere is exactly one solution.\u003c/li\u003e \n \u003c/ul\u003e \n \u003ch3\u003eSubtasks\u003c/h3\u003e \n \u003cul\u003e \n \u003cli\u003eSubtask #1 (40 points) \u003cb\u003e3\u003c/b\u003e ≤ \u003cb\u003eN\u003c/b\u003e ≤ \u003cb\u003e1000\u003c/b\u003e\u003c/li\u003e \n \u003cli\u003eSubtask #2 (60 points) Original constraints\u003c/li\u003e \n \u003c/ul\u003e \n \u003ch3\u003eExample\u003c/h3\u003e \n \u003cpre\u003e\u003cb\u003eInput:\u003c/b\u003e\n\u003ctt\u003e4\n5\n45 42 46 48 47\n3\n7 7 8\n8\n12 156 157 158 159 160 161 162\n4\n8 7 10 6\u003c/tt\u003e\n\n\u003cb\u003eOutput:\u003c/b\u003e\n\u003ctt\u003e42\n7\n12\n10\u003c/tt\u003e\n\u003c/pre\u003e \n \u003ch3\u003eExplanation\u003c/h3\u003e \n \u003cp\u003e\u003cb\u003eTest case 1.\u003c/b\u003e The sequence \u003cb\u003eA\u003c/b\u003e is (45, 42, 46, 48, 47). We should remove the number 42, and the remaining numbers will form a nice sequence (45, 46, 48, 47).\u003c/p\u003e \n \u003cp\u003e\u003cb\u003eTest case 2.\u003c/b\u003e We should remove one of two 7\u0027s to get the sequence (7, 8), which is nice.\u003c/p\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}}]}