Here is a handy link to the official EU calculator for determining if you can stay longer in the EU / Schengen Travel Area without having a formal visa.
There are other 'rule of thumb' methods that are based on counting backwards from your planned dates and to include the dates you were previously in the Schengen Travel Area. But this is the official calculator likely used by the border authorities.
Short-stay Visa Calculator
With the aid of the Short-stay Visa Calculator, you can calculate how many travel days remain under your Schengen short-stay visa.
ec.europa.eu
There are other 'rule of thumb' methods that are based on counting backwards from your planned dates and to include the dates you were previously in the Schengen Travel Area. But this is the official calculator likely used by the border authorities.