# Can You Solve a Magic Square?

Given above is a $$4 \times 4$$ grid. In how many ways can you fill numbers from 1 to 16 inclusive in each individual box of the above grid such that sum of numbers in all the rows, columns, and main diagonals are the same?

Details and Assumptions:

• Main diagonals are the diagonals connecting the vertices of the grid.

• For a grid to qualify, the sum of numbers in it's every row, column, and main diagonal must be the same. Sum of rows or columns or diagonals of two separate grids may not be the same.

• Rotations and reflections of the grid don't count distinct.

• Every digit from 1 to 16 inclusive must be used exactly once.

• An explicit example of such grid -

×