def solve(a) return (0...N).any? {|i| a.each_with_index.all? {|j, k| k < i ? j <= k + 1 : j <= N - k + i} } end N = gets.to_i a = gets.split.map &:to_i puts solve(a) || solve(a.reverse) ? "Yes" : "No"