(defn repeat-read [n]
  (for [i (range n)] (read)))

(defn create-data []
  (->>
   (repeat-read (read)) 
   (int-array)))

(defn traind [i arr countor]
  (cond
    (= i 2) countor
    (= (alength arr) countor) -1
    :else (recur (aget arr (- i 1)) arr (inc countor))))

(println (traind 1 (create-data) 0))