{"raw_statement":[{"iden":"problem statement","content":"You observed amoebae and kept some records.\nInitially, there was one amoeba, numbered $1$.\nYou made $N$ records. According to the $i$\\-th record, the amoeba numbered $A_i$ disappeared by dividing itself into two new amoebae, which were then numbered $2i$ and $2i+1$.  \nHere, amoeba $A_i$ is said to be the parent of amoebae $2i$ and $2i+1$.\nFor each $k=1,\\ldots,2N+1$, how many generations away is amoeba $k$ from amoeba $1$?"},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2\\times 10^5$\n*   The records are consistent. That is:\n    *   $1\\leq A_i \\leq 2i-1$.\n    *   $A_i$ are distinct integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\ldots$ $A_N$"},{"iden":"sample input 1","content":"2\n1 2"},{"iden":"sample output 1","content":"0\n1\n1\n2\n2\n\nFrom amoeba $1$, amoebae $2$ and $3$ were born. From amoeba $2$, amoebae $4$ and $5$ were born.\n\n*   Amoeba $1$ is zero generations away from amoeba $1$.\n*   Amoeba $2$ is one generation away from amoeba $1$.\n*   Amoeba $3$ is one generation away from amoeba $1$.\n*   Amoeba $4$ is one generation away from amoeba $2$, and two generations away from amoeba $1$.\n*   Amoeba $5$ is one generation away from amoeba $2$, and two generations away from amoeba $1$."},{"iden":"sample input 2","content":"4\n1 3 5 2"},{"iden":"sample output 2","content":"0\n1\n1\n2\n2\n3\n3\n2\n2"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}