Arthur Schopenhauer said this quote

Mostly it is loss which teaches us about the worth of things.