Yes, and …
“Calories in” is half. “Calories out” (the amount you burn) is the other half.
Having been on the “nothing but diet” train for long windows of my life I can confidently say that if you don’t pair the former and latter, you’ll end up in the yo-yo cycle. Over and over again. Took a long time for me to understand that and I STILL struggle.