Find linear relation between stacked iron blocks
An ultrasonic transducer could project pulses of sound up through the stack. The top of the stack would produce a reflection, and the interfaces between blocks might produce reflections, too.

The speed of sound in iron is rather high &mdash; about 5000 m/s &mdash; so you'll need to measure time with a resolution on the order of \$\frac{0.05 m}{5000 m/s} = 10 \mu s\$ in order to count the blocks reliably.

What exactly do you intend to do with this information? How will you power the circuit?