{"problem":{"name":"XOR to All","description":{"content":"You are given a sequence of non-negative integers $A = (A_1, \\ldots, A_N)$. You can do the operation below any number of times (possibly zero). *   Choose an integer $x\\in {A_1,\\ldots,A_N}$. *   Repl","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc135_c"},"statements":[{"statement_type":"Markdown","content":"You are given a sequence of non-negative integers $A = (A_1, \\ldots, A_N)$. You can do the operation below any number of times (possibly zero).\n\n*   Choose an integer $x\\in {A_1,\\ldots,A_N}$.\n*   Replace $A_i$ with $A_i\\oplus x$ for every $i$ ($\\oplus$ denotes the bitwise $\\mathrm{XOR}$ operation).\n\nFind the maximum possible value of $\\sum_{i=1}^N A_i$ after your operations.\nWhat is bitwise $\\mathrm{XOR}$?The bitwise $\\mathrm{XOR}$ of non-negative integers $A$ and $B$, $A \\oplus B$, is defined as follows:\n\n*   When $A \\oplus B$ is written in base two, the digit in the $2^k$'s place ($k \\geq 0$) is $1$ if exactly one of $A$ and $B$ is $1$, and $0$ otherwise.\n\nFor example, we have $3 \\oplus 5 = 6$ (in base two: $011 \\oplus 101 = 110$).\n\n## Constraints\n\n*   $1\\leq N \\leq 3\\times 10^{5}$\n*   $0\\leq A_i < 2^{30}$\n\n## Input\n\nInput is given from Standard Input from the following format:\n\n$N$\n$A_1$ $\\ldots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc135_c","tags":[],"sample_group":[["5\n1 2 3 4 5","19\n\nHere is a sequence of operations that achieves $\\sum_{i=1}^N A_i = 19$.\n\n*   Initially, the sequence $A$ is $(1,2,3,4,5)$.\n*   An operation with $x = 1$ changes it to $(0,3,2,5,4)$.\n*   An operation with $x = 5$ changes it to $(5,6,7,0,1)$, where $\\sum_{i=1}^N A_i = 5 + 6 + 7 + 0 + 1 = 19$."],["5\n10 10 10 10 10","50\n\nDoing zero operations achieves $\\sum_{i=1}^N A_i = 50$."],["5\n3 1 4 1 5","18"]],"created_at":"2026-03-03 11:01:14"}}