Another more "compact" method I would recommend is to create a base content type from which all your document content types would derive. The base content type would contain a column field to contain the assigned counter value, and a policy. The policy contains the counter, which would be kept up to date by a simple helper routine run in the document library ItemAdded event