Is the output size of the last layer of a standard fully connected neural network the same as the input size?
In a Dense NN,

Input to a Layer depends on the output of the previous layer and its Neuron count
Previous Layer for the first layer is the Input Data Features
Output of a Layer is equal to the Layer's neuron count. A copy of each goes to all the Neuron of the Next Layer

It means for your case,
- First Layer will have *M(Input features)3 inputs going in i.e. M to each Neuron and 3 coming out.
 - The Second layer will have *3(Previous Layer)5 inputs going in and 5 coming out
 - The Last layer will have 5(Previous Layer)*2 inputs going in and 2 coming out
A Neural Network is a complex Tensor operation. Arrow and Circle are logical representations. Each arrow got a weight and each Circle got the Activation function and the Bias term. So, you may count this way too.
$\hspace{3cm}$
 Validate this with Keras Model.summary result which shows the parameter count.