Math is not my strong point, so I'm writing my reasoning so that if I'm wrong, somebody can explain and I can learn.

It's not just a math problem, because that would assume that every bale is exactly identical, that your walls are perfectly square, and that you could stack hay absolutely packed tight so that there were no gaps anywhere. None of those things are true.

You have a little wiggle room with your ceiling, so you know you can stack bales that are approximately 18" deep 6 high.

Your bales are about 3' long, and your 42" wall is equal to 14 yards. That's where the reality comes in--I don't think you can pack the bales that tight. If you put them in with the short sides in that direction, you could fit in 36 if all measurements were perfect, but that doesn't happen in the reality of hay and barns. So you can fit in 35 bales.

That leaves your 16' wall, which lets you fit in 5 bales lengthwise with a little wiggle room.

5 x 35 x 6 = 1050