Words#131

Words

1 second
64 megabytes
Very easy

From the word "moloko", you can form the word "kolo". Given a word and a dictionary, determine how many words in the dictionary can be formed using the letters from the given word, with each letter used at most once.

Input

The first line contains the given word.The second line contains an integer — the number of words in the dictionary.The next lines each contain a word from the dictionary.

Output

Print a single integer: the number of dictionary words that can be formed from the given word.

Examples

Example 5

Loading
Loading

Note

The words "kolo" and "oko" can be formed from the letters of "moloko", but "koma" cannot.