Yttrium, barium, and the lanthanides in Ap and Am stars