How to work out how many combinations in a $16\times 16$ grid with $256$ values in each? I have a $16\times16$ grid. $256$ squares.

In each square there can be a value from $1$-$256$.

How do I work out how many total combinations the complete grid could have?

I would like the know the formula so I can work it out for different grid sizes.
EDIT (thanks for @RSerrao's comment): If, the values are distinc, you can think like this: the first cell can have 256 posibilities, the second cell can have 255 posibilities and so on. Then, you can get the formula.

If not, i.e. the values can be repeated, so each cell has 256 posibilities.
if you have a n*n grid then the total numbers you can use is n^2 , now at a first square u have chances (n^2)chances ,in the next you have (n^2-1) chances , in such a process the total set of combination you have (n^2)!.