Counting binary operations on a set with $n$ elements
If $A$ and $B$ are two finite sets with $|A| = m$ and $|B| = n$ then the number of maps from $A$ to $B$ is $|B|^{|A|} = n^m$. This is because the function must be defined on each of $|A|=m$ members of $A$ and for each of those m members there are $|B|=n$ possible values. Thus, there are $$\Pi_{i=1}^{m}n=n^m$$ different possible functions from $A$ to $B$.
If we apply this to maps from $S\times S\rightarrow S$ we get $|S|^{|S\times S|}=n^{(n^2)}$.
For commutative maps, we require that $(p,q)$ and $(q,p)$ be mapped to the same value. The elements of $S\times S$ are in $1$-$1$ correspondence with the entries of a square $n\times n$ matrix. Commutative maps map an entry of the lower triangle of this matrix to the same value of the corresponding entry of the upper trianglular matrix. Therefore the domain will have cardinality $\frac{n(n+1)}{2}$ and so there will be $n^{(\frac{n(n+1)}{2})}$ commutative maps from $S\times S$ to $S.$