Ivan fond genealogy currently study particular genealogical structure consist people in structure person parent specify Additionally person exactly child special person child the people structure conveniently number 1 n s_i denote child person s_i 0 exactly person childrenWe ancestor b b child ancestor b that ancestor s_a s_s_a etcWe person imbalance case person parent specify total number ancestor parent double Ivan count number imbalance people structure get k people total however sure compute correctly like check construction n people k imbalanced people total please help find construction determine exist