N = gets.to_i

s = Array.new(N)
for i in 0...N
    s[i] = gets.split(/\s*/).sort.join("")
end

ans = 0
for i in 0...N
    for j in i+1...N
        if s[i] == s[j]
            ans += 1
        end
    end
end

puts ans