It's basically the same as using the subquery but using another CTE.
WITH tmpTable AS (
SELECT DISTINCT *,
ROW_NUMBER() OVER ( ORDER BY InventorySys ) AS RowNumber
FROM dbo.Inventory
),
Total AS(
SELECT totalCount = Count(*)
FROM tmpTable
)
SELECT tmp.* , tot.totalCount as RecordsCount
FROM tmpTable tmp
CROSS JOIN Total tot
WHERE (tmp.RowNumber BETWEEN 1 AND 6) OR 1 = 0 OR 6 = 0
ORDER BY tmp.RowNumber