(defn duplicate-n [n x] (flatten (map #(repeat n %) x)))