If I have to do something like that, it sounds like a subreport...Detail A becomes the subreport, so you can report back to the main via a shared variable or displayed. If you want to the number later on in the report, I would go the shared variable route.
Definitely sounds like a subreport, but someone else may have different approach.
Hope this helps