formula to count numbers inclusive?

Hello all - newbie question: I am making an index of chapters in a series of books, and I have one cel for the first page and the next cel for the last page.

Example - Chapter One begins on page 1, ends on page 5.
I’d like to make the third cel count the numbers inclusive. Answer of course should be 5.

I’ve tried subtracting 5-1 but of course that doesn’t work, as there are 5 pages in the chapter.

I’ve made a little workaround formula (cel 2-cel1)+1
but is there a better way of doing this?
I am looking to eventually bring the table into a calc database.

Thank you for your consideration,
Margaret

I’ve made a little workaround formula (cel 2-cel1)+1

This isn’t a workaround, but the formula how that calculation works

What @anon73440385 says. When you hold a range’s first and last elements, range element count is returned by exactly that formula. You might have numbers of this range’s first element and next one’s, then simply subtract them - but that has many conditions to fulfill to work correctly: every next chapter must start on the next page after previous (not on same, nor separated by random inserts); special handling of last chapter etc.

Thank you both: @anon73440385 for the validation and @Mike2 Kaginski for pointing out potential problems if the strict conditions are not met.
Margaret