The act of perceiving quantity without actually counting is known as subitizing, and it's something we can all do up to quantities of about 4 (i.e. you can tell how many fingers someone is holding up without counting them, right?).
This open access article seems to review the idea quite nicely (although I've only skimmed it), including reference to so called "savants". There's also this paper, claiming that transcranial magnetic stimulation can temporarily induce subitizing abilities for larger numbers in participants, though personally I'm dubious.
Finally, to the best of my knowledge, the original, and definitive account of this ability (on which the scene in Rain Man was apparently based; Kim Peek, the inspiration for most of the film, apparently didn't couldn't, or didn't subitize like this) was by Oliver Sachs, in this wonderful book, but basically summarized in this article. If you really are interested, I can't recommend the book strongly enough, it's the reason I did psychology in the first place. It should probably be noted that I've heard criticisms of Sachs' account of the Twins somewhere, but I can't currently find a reference for them, so I don't think it's universally accepted that anyone can actually do this in reality.