Artificial intelligent assistant

How many permutation are there of n distinct elements if two specific elements will not appear either in the 1st place or in the last place? Let the elements be $a_1$,$a_2$,...,$a_n$. Let the two specific letters be $a_1$ and $a_2$. What does the question mean when it says that TWO letters do not appear either in the first place or in the last place? Does it mean that neither can they occupy the first place nor the last place? Or does it mean that if they do not occupy the first place, they are free to occupy all other places and if they do not occupy the last place, they are free to occupy all other places?

If I have interpreted the question correctly then the method is as follows.

First permute the two specific elements at the ends in $2!$ ways and the rest in $(n-2)!$ways . Now we need to subtract this case from all the permutations that can be done using all $n$ elements which is $n! $

Hence the answer to the question can be given as $$n! -(n-2)!2!=(n-2)!(n-2)(n+1)$$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 99e717f2d40fe87e5f7119d73c104fec