{"problem":{"name":"[LMXOI Round 1] Size","description":{"content":"魔女给出一个长度为 $n$ 的序列 $d$，魔女想要求得： $$\\sum\\limits_{i=1}^{ n}\\sum\\limits_{j=1}^{n}{((d_i\\oplus d_j)+(d_i \\otimes d_j))}$$ 其中定义 $\\oplus$ 代表二进制下两数相加的和数位上 $1$ 的个数， $\\otimes$ 代表二进制下较大减较小的差数位上 $1$ 的个数。","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":524288},"difficulty":{"LuoguStyle":"P4"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP10114"},"statements":[{"statement_type":"Markdown","content":"魔女给出一个长度为 $n$ 的序列 $d$，魔女想要求得：\n\n$$\\sum\\limits_{i=1}^{ n}\\sum\\limits_{j=1}^{n}{((d_i\\oplus d_j)+(d_i \\otimes d_j))}$$\n\n其中定义 $\\oplus$ 代表二进制下两数相加的和数位上 $1$ 的个数， $\\otimes$ 代表二进制下较大减较小的差数位上 $1$ 的个数。\n\n## Input\n\n一行一个整数 $n$ 表示序列的长度。\n\n第二行 $n$ 个非负整数，表示序列 $d$。\n\n## Output\n\n一行一个整数表示答案。\n\n[samples]\n\n## Background\n\n在漆黑的夜晚，魔女带走了 LMX，HQZ 为了拯救 LMX。要完成魔女给出的任务。\n\n## Note\n\n**样例解释 #1**\n\n如下表所示，因此答案为 $1 + 2 + 2 + 2 = 7$。\n| $i$ | $j$ | $ans$ |\n| :-----: | :-----: | :-------: |\n| $1$ | $1$ | $1$ |\n| $1$ | $2$ | $2$ |\n| $2$ | $1$ | $2$ |\n| $2$ | $2$ | $2$ |\n\n对于 $100 \\%$ 的数据，保证 $1 \\le n\\le 2\\times 10^6,\\sum\\limits d_i\\le5\\times10^7$。 \n| 子任务编号 |     $n$     |          特殊性质          | 分值 |\n| :--------: | :------------------: | :-------------------------: | :--: |\n| Subtask #1 |     $\\le 2\\times10^6 $     |   $d_i =1$       |  $10$  |\n| Subtask #2 |     $\\le 5000$     |      无      |  $20$  |\n| Subtask #3 | $\\le 2\\times 10^6$ | $d_i$ 是 $2$ 的次幂 |  $30$  |\n| Subtask #4 | $\\le 2\\times 10^6$ |      无      |  $40$  |","is_translate":false,"language":"English"}],"meta":{"iden":"LGP10114","tags":["O2优化"],"sample_group":[["2\n1 3 ","7"],["10\n114514 19 19 810 1477 44151 15260 369 2010 222","1396"]],"created_at":"2026-03-03 11:09:25"}}