{"raw_statement":[{"iden":"statement","content":"Stepan has a set of _n_ strings. Also, he has a favorite string _s_.\n\nStepan wants to do the following. He will take some strings of his set and write them down one after another. It is possible that he will take some strings more than once, and will not take some of them at all.\n\nYour task is to determine the minimum number of strings in the set which Stepan needs to take and write so that the string _s_ appears as a subsequence in the resulting written down string.\n\nFor example, in the string \"_abcd_\" strings \"_ad_\", \"_acd_\", \"_abcd_\" appear as subsequences, and strings \"_ba_\", \"_abdc_\" don't appear as subsequences."},{"iden":"input","content":"The first line contains the integer _n_ (1 ≤ _n_ ≤ 50) — the number of strings in Stepan's set.\n\nThe next _n_ lines contain _n_ non-empty strings consisting of lowercase letters of the English alphabet. The length of each of these strings does not exceed 50 symbols. It is possible that some strings from Stepan's set are the same.\n\nThe next line contains the non-empty string _s_, consisting of lowercase letters of the English alphabet — Stepan's favorite string. The length of this string doesn't exceed 2500 symbols."},{"iden":"output","content":"Print the minimum number of strings which Stepan should take from the set and write them down one after another so that the string _s_ appears as a subsequence in the resulting written down string. Each string from the set should be counted as many times as Stepan takes it from the set.\n\nIf the answer doesn't exsist, print _\\-1_."},{"iden":"examples","content":"Input\n\n3\na\naa\na\naaa\n\nOutput\n\n2\n\nInput\n\n4\nab\naab\naa\nbb\nbaaab\n\nOutput\n\n3\n\nInput\n\n2\naaa\nbbb\naaacbbb\n\nOutput\n\n\\-1"},{"iden":"note","content":"In the first test, Stepan can take, for example, the third and the second strings from the set, write them down, and get exactly his favorite string.\n\nIn the second example Stepan can take, for example, the second, the third and again the second strings from the set and write them down. Then he will get a string \"_aabaaaab_\", in which his favorite string \"_baaab_\" is a subsequence.\n\nIn the third test Stepan can not get his favorite string, because it contains the letter \"_c_\", which is not presented in any of the strings in the set."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":null,"simple_statement":null,"has_page_source":false}