N = gets.to_i
tmpl_hash = {}
[*97..122].each do |code|
    tmpl_hash[code.chr] = 0
end
list = []
res = 0
N.times do |i|
    s = gets.chomp
    h = Marshal.load(Marshal.dump(tmpl_hash))
    s.split('').each do |q|
        h[q] += 1
    end
    list.each do |l|
        if l == h then
            res += 1
        end
    end
    list.push h
end
puts res