I’ll interpret your question as follows. You have an n×nn×n grid of n2n2 cells. You’ve got one color. Each square can be either colored or left uncolored. (I’ll use 0 for uncolored and 1 for colored.) How many ways can the cells be colored so that no two rows have the same number of colored cells and no two columns have the same number of colored cells.
For example, when n=2n=2, there are four squares. The 8 ways of coloring them are Not counting the permutations of the rows and columns, there are only two ways: you can have 0 cells painted in one row and 1 in the other, or you can have 1 cell painted in one row and 2 in the other. In each case, the same number of painted cells occurs in the columns.
When n=3n=3, not counting permutations, there are only two ways. You can have 0 cells painted in one row, 1 in another, and 2 in the third; or you can have 1 cell painted in one row, 2 in the other, and 3 in the third. Dinar Detectives