By becoming unhappy, we sometimes learn how to be less so.