require 'set' def solve(ars) a = [] ars.each do |s1| brs = ars.dup brs.delete(s1) brs.each do |s2| a << s1 + s2 end end Set.new(a).size end n = gets.chomp.to_i ars = Array.new(n){gets.chomp} puts solve(ars)