n = gets.to_i
stack = []
answer = nil
gets.split.map(&:to_i).each_with_index do |x, i|
  if x > 0
    if stack.include?(x)
      answer = i + 1
      break
    else
      stack << x
    end
  else
    if stack[-1] != -x
      answer = i + 1
      break
    else
      stack.pop
    end
  end
end
puts answer || 'OK'
