Is this question grammatically sound? It sounds slightly weird to me, and not sure if it can be paraphrased. Could somebody clarify please?
I don't think the question makes any sense in its current form. A corrected version might be:
How many girls did you ask for their names?
I'm not exactly sure if "names" should be plural or singular, since the number agreement is complicated in this form (since you're presumably asking each girl for just one name, her own).
The question might also work with the "for" omitted completely. Whether "for" is required, optional or forbidden may vary by dialect (I'd almost always use it myself).
Note that having "for" at the end of a question can work in a different context. For instance this seems perfectly valid to me as a native AmE speaker:
How many dollars are you asking me for?