n = read_line.to_i a = read_line.split.map(&.to_i64).sort puts a.each_slice(2).sum { |(i, j)| i * j }