Here's the simplest form I could distill it to. The other comments I find quite verbose or confusing, no offense intended.
x: Ann's current age
y: The age difference between Ann and Mary
24 = x + y (ie. their current ages)
x = (24/2) + y (ie. their age in the past)
Solve for y in one equation and plug it into the other. You'll get x = 18.