{"raw_statement":[{"iden":"statement","content":"You are given an array a consists of n elements, find the maximum number of elements you can select from the array such that the absolute difference between any two of the chosen elements is  ≤ 1.\n\nThe first line contains an integer T (1 ≤ T ≤ 100), in which T is the number of test cases.\n\nThe first line of each test case consist of an integer n (2 ≤ n ≤ 104), in which n is size of the array a\n\nThe a line follow containing n elements a1, a2, ..., an (1 ≤ ai ≤ 104), giving the array a.\n\nFor each test case, print a single line containing the maximum number of elements you can select from the array such that the absolute difference between any two of the chosen elements is  ≤ 1.\n\n"},{"iden":"input","content":"The first line contains an integer T (1 ≤ T ≤ 100), in which T is the number of test cases.The first line of each test case consist of an integer n (2 ≤ n ≤ 104), in which n is size of the array aThe a line follow containing n elements a1, a2, ..., an (1 ≤ ai ≤ 104), giving the array a."},{"iden":"output","content":"For each test case, print a single line containing the maximum number of elements you can select from the array such that the absolute difference between any two of the chosen elements is  ≤ 1."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of cadets.  \nLet $ S = (s_1, s_2, \\dots, s_n) $ be the sequence of scores, where $ s_i $ is the score of the $ i $-th cadet (in finishing order).\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 10^5 $  \n2. $ 0 \\leq s_i \\leq 10^6 $ for all $ i \\in \\{1, \\dots, n\\} $\n\n**Objective**  \nFor each cadet $ i \\in \\{1, \\dots, n\\} $, compute the grade $ g_i $ as:  \n$$\ng_i = n - \\left| \\left\\{ j \\in \\{1, \\dots, i-1\\} \\mid s_j \\geq s_i \\right\\} \\right|\n$$","simple_statement":"For each cadet, his grade is: n minus the number of cadets who finished before him and scored at least as many points as him.","has_page_source":false}