Is Palladium an exception?
As suggested by M.Sameer I convert my comment into an answer:
Dear M.Sameer: It seems that you are missing that the $n+\ell$ Madelung rule is not an exact result derived from first principles, but rather a rule of thumb, that holds for, say, approximately 95 percent of all the elements, with important exceptions, cf. this wikipedia page. Nevertheless, there are semi-rigorous theoretical arguments why such a rule of thumb should hold to a good approximation.