{"problem":{"name":"J. Parallelograms","description":{"content":"There are n sticks, the i-th of which has length ai. Alex wants to assemble from them as many parallelograms as possible simultaneously, with each stick used at most in one parallelogram. What maximal","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10175J"},"statements":[{"statement_type":"Markdown","content":"There are n sticks, the i-th of which has length ai. Alex wants to assemble from them as many parallelograms as possible simultaneously, with each stick used at most in one parallelogram. What maximal number of parallelograms is it possible to assemble?\n\nThe first line contains a single integer n (1 ≤ n ≤ 200000) — the number of sticks.\n\nThe second line contains n integers ai (1 ≤ ai ≤ 200000) — the lengths of sticks.\n\nOutput a single integer — the maximal number of parallelograms that is possible to assemble.\n\n## Input\n\nThe first line contains a single integer n (1 ≤ n ≤ 200000) — the number of sticks.The second line contains n integers ai (1 ≤ ai ≤ 200000) — the lengths of sticks.\n\n## Output\n\nOutput a single integer — the maximal number of parallelograms that is possible to assemble.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of sticks.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of positive integers representing stick lengths.  \n\nLet $ f: \\mathbb{Z}^+ \\to \\mathbb{Z}^+ $ be the frequency function, where $ f(l) $ denotes the number of sticks of length $ l $.  \n\n**Constraints**  \n1. $ 1 \\le n \\le 200000 $  \n2. $ 1 \\le a_i \\le 200000 $ for all $ i \\in \\{1, \\dots, n\\} $  \n\n**Objective**  \nMaximize the number of parallelograms, where each parallelogram requires two pairs of sticks of equal lengths (i.e., four sticks: two pairs of equal-length sides).  \n\nEach stick may be used in at most one parallelogram.  \n\nLet $ x $ be the number of parallelograms. Then:  \n$$\nx = \\sum_{l=1}^{\\max(A)} \\left\\lfloor \\frac{f(l)}{2} \\right\\rfloor\n$$  \nLet $ m = \\sum_{l=1}^{\\max(A)} \\left\\lfloor \\frac{f(l)}{2} \\right\\rfloor $.  \nThen the maximum number of parallelograms is:  \n$$\n\\left\\lfloor \\frac{m}{2} \\right\\rfloor\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10175J","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}