{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThere was a lot of relatives on Ira\u0027s birthday party, so that to remember them all was not so easy task. In order to obtain an overall picture, the idea to make a family tree was born. Due to error in one of tree building procedures it turned out that the tree was not binary, although the number of vertices was correct --- \u003cstrong\u003e2^k-1\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003e--- \u003cem\u003eSomething is wrong here. \u003c/em\u003e --- Really\u003cem\u003e? \u003c/em\u003e --- \u003cem\u003eI propose to double-check everything. \u003c/em\u003e --- \u003cem\u003eSpecifi\u001ccally. \u003c/em\u003e --- \u003cem\u003eDivide the tree into connected parts of\u003c/em\u003e \u003cstrong\u003e2^i\u003c/strong\u003e \u003cem\u003evertices, and each of us will check his part. \u003c/em\u003e --- \u003cem\u003eWhy do you want to do that this way?\u003c/em\u003e --- \u003cem\u003eI do not know, I just like powers of two, and also the sum will be exactly what we need. Although there is a little problem: you can do that in a bunch of ways. \u003c/em\u003e --- \u003cem\u003eYes, I remember the student\u0027s record-books, and Sudoku. How many ways are here this time? \u003c/em\u003e --- \u003cem\u003eYou have a great memory, give me a few minutes to think about it\u003c/em\u003e. --- \u003cem\u003eCatch it.\u003c/em\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003ch2\u003eInput\u003c/h2\u003e\u003c/p\u003e\n\n\u003cp\u003eThe fi\u001crst line contains an integer \u003cstrong\u003eN\u003c/strong\u003e\u003d\u003cstrong\u003e2^k-1\u003c/strong\u003e --- number of vertices in the tree (\u003cstrong\u003e1\u003c/strong\u003e ≤ \u003cstrong\u003ek\u003c/strong\u003e ≤ \u003cstrong\u003e12\u003c/strong\u003e). The next line contains \u003cstrong\u003eN-1\u003c/strong\u003e integers. Integer \u003cstrong\u003ea_i\u003c/strong\u003e (\u003cstrong\u003e1\u003c/strong\u003e ≤ \u003cstrong\u003ea_i\u003c/strong\u003e \u003c \u003cstrong\u003ei+1\u003c/strong\u003e) on \u003cstrong\u003ei\u003c/strong\u003e-th position denotes that there is an edge between vertices \u003cstrong\u003ei+1\u003c/strong\u003e and \u003cstrong\u003ea_i\u003c/strong\u003e. Vertices are numbered starting from \u003cstrong\u003e1\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003e\u003ch2\u003eOutput\u003c/h2\u003e\u003c/p\u003e\n\n\u003cp\u003ePrint a single integer --- the number of ways to divide the tree into exactly \u003cstrong\u003ek\u003c/strong\u003e connected blocks of sizes \u003cstrong\u003e1\u003c/strong\u003e, \u003cstrong\u003e2\u003c/strong\u003e, \u003cstrong\u003e4\u003c/strong\u003e, ..., \u003cstrong\u003e2^k-1\u003c/strong\u003e. Each vertex must belong to exactly one block.\u003c/p\u003e\n\n"}},{"title":"Example","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e7\n1 1 2 2 3 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}