(defn input []
  (vector
    (Integer/parseInt (read-line))
    (->> (clojure.string/split (read-line) #"\s")
      (mapv #(Integer/parseInt %)))))

(defn Thumbnail [[N As]]
  (let [avg (/ (apply + As) (count As))
        tmp (map #(Math/abs (double (- % avg))) As)
        result (.indexOf tmp (apply min tmp))]
    (when (= -1 result) (throw (Exception. "Error")))
    result))

(->> (input)
  Thumbnail
  println)