\[d(n)=n!\sum_{j=0}^{n}(-1)^{j}\frac{1}{j!}=\left\lfloor\frac{n!+\mathrm{e}-2}{%
\mathrm{e}}\right\rfloor.\]