시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 (추가 시간 없음) 512 MB 1 1 1 100.000%

문제

A set of words is called swap free if there is no way to turn any word in the set into any other word in the set by swapping only a single pair of (not necessarily adjacent) letters.

You are given a set of n words that are all anagrams of each other. There are no duplicate letters in any word. Find the size of the largest swap free subset of the given set. Note that it is possible for the largest swap free subset of the given set to be the set itself.

입력

The first line of input contains a single integer n (1 ≤ n ≤ 500).

Each of the next n lines contains a single word w (1 ≤ |w| ≤ 26).

Every word contains only lower-case letters and no duplicate letters. All n words are unique, and every word is an anagram of every other word.

출력

Output a single integer, which is the size of the largest swap free subset.

예제 입력 1

6
abc
acb
cab
cba
bac
bca

예제 출력 1

3

예제 입력 2

11
alerts
alters
artels
estral
laster
ratels
salter
slater
staler
stelar
talers

예제 출력 2

8

예제 입력 3

6
ates
east
eats
etas
sate
teas

예제 출력 3

4