{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eSpace tourism has gained unprecedented popularity in recent years. There \r\nare lots of people wishing to look closely at a triple star, walk on \r\nthe surface of a small asteroid or plunge into the depths of a gas \r\ngiant. Passenger ships began to fly between all popular star sectors. But \r\nthere is a little problem—a flight to a place of interest may take \r\nseveral weeks, and you need to escape the boredom somehow, because \r\neven a view out of the observation window doesn\u0027t change very often.\r\nThat\u0027s why many people now take a great interest in reading visual novels.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eA visual novel is one of the attempts to rethink the conventional literature which \r\nbecame possible after the mass transfer of books to electronic devices. The main \r\ndifference of the visual novel from an usual book is that its plot \r\ncan branch out, and after a few pages the reader may have \r\nmore than one option of choosing which page is next. The moments when \r\nthe reader has to make choices are called branches.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eMany readers like to explore the entire novel, reading all possible \r\nscenarios. After reaching one of the possible endings, they return to the beginning \r\nof the story and try other plot variants. You, as the author of the novel “The \r\nsong of Asya”, want to make life of such readers easier.\r\nFirst, after reading several endings the reader forgets for \r\nwhat choices he has already explored all possible ways of further plot\r\ndevelopment. So you have decided that the story should not offer options \r\nwhich lead the reader to the fully explored chains of events. Secondly, \r\nyou have decided to add a button, which skips all the intermediate pages \r\nof a story to the nearest branch or the finale. If you accidentally \r\npress this button on a branch page, then nothing happens.\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eYou have written all the chains of choices, leading to all the possible endings, and you \r\nwant to assess the total number of button clicks needed to choose the plot lines \r\nand skip the unambiguous choices, which the reader needs in the best case to read the entire novel in all its versions.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first line contains an integer \u003ci\u003en\u003c/i\u003e that is an amount of different endings of the story (1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 10\u003csup\u003e5\u003c/sup\u003e).\r\nThe \u003ci\u003ei\u003c/i\u003e\u0027th from the following \u003ci\u003en\u003c/i\u003e lines contains a non-empty line of lowercase Latin letters, describing all choices of the plot on the way to the \u003ci\u003ei\u003c/i\u003e\u0027th ending.\r\nIt is guaranteed that none of the lines is a prefix of the other line.\r\nThe total length of lines does not exceed 10\u003csup\u003e5\u003c/sup\u003e.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eOutput the minimum amount of button clicks necessary to read all the possible variants of the plot.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Sample","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\u003e3\r\naza\r\nazc\r\nb\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Notes","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eIf we denote the choice button clicks with Latin letters, and \r\nthe skip branch button clicks with the “*” symbol, \r\nthen one of the optimal strategies is “b*c*”.\u003c/div\u003e\u003c/div\u003e"}}]}