_ = gets.to_i
c = gets.split.map(&:to_i)
x = []
ans = -1
c.each_with_index do |_c, i|
  if _c.positive?
    if x.include?(_c)
      ans = i + 1
      break
    else
      x << _c
    end
  else
    _c *= -1
    if x.include?(_c) && x.last == _c
      x.delete(_c)
    else
      ans = i + 1
      break
    end
  end
end
puts ans == -1 ? 'OK' : ans
