Solution:
We first note that the main diagonal (the squares with row number equal to column number) is a permutation of 1,2,…,n. This is because each number i (1≤i≤n) appears an even number of times off the main diagonal, so must appear an odd number of times on the main diagonal. Thus, we may assume that the main diagonal's values are 1,2,…,n in that order. Call any matrix satisfying this condition and the problem conditions good. Let g(n) denote the number of good matrices. It now remains to show that g(n)≥φ(n)(n−1)!.
Now, consider a round-robin tournament with n teams, labeled from 1 through n, with the matches spread over n days such that on day i, all teams except team i play exactly one match (so there are 2n−1 pairings), and at the end of n days, each pair of teams has played exactly once. We consider two such tournaments distinct if there is some pairing of teams i,j which occurs on different days in the tournaments. We claim that the tournaments are in bijection with the good matrices.
Proof of Claim: Given any good matrix A, we construct a tournament by making day k have matches between team i and j for each i,j such that Ai,j=k, besides (i,j)=(k,k). Every pair will play some day, and since each column and row contains exactly one value of each number, no team will play more than once a day. Furthermore, given two distinct good matrices, there exists a value (off the main diagonal) on which they differ; this value corresponds to the same pair playing on different dates, so the corresponding tournaments must be distinct. For the other direction, take any tournament. Make a matrix A with the main diagonal as 1,2,…,n, and for each k, set Ai,j=k for each i,j such that teams i,j play each other on day k. This gives a good matrix. Similarly, given any two distinct tournaments, there exists a team pair i,j which play each other on different days; this corresponds to a differing value on the corresponding good matrices.
It now suffices to exhibit φ(n)(n−1)! distinct tournaments. (It may be helpful here to think of the days in the tournament as an unordered collection of sets of pairings, with the order implicitly imposed by the team not present in the set of pairings.) For our construction, consider a regular n-gon with center O. Label the points as A1,A2,…,An as an arbitrary permutation (so there are n! possible labelings). The team k will be represented by Ak. For each k, consider the line AkO. The remaining n−1 vertices can be paired into 2n−1 groups which are perpendicular to this line; use these pairings for day k. Of course, this doesn't generate n! distinct tournaments—but how many does it make?
Consider any permutation of labels. Starting from an arbitrary point, let the points of the polygon be Aπ(1),Aπ(2),…,Aπ(n) in clockwise order. Letting π(0)=π(n) and π(n+1)=π(1), we note that π(i−1) and π(i+1) play each other on day π(i). We then see that any other permutation of labels representing the same tournament must have Aπ(i−1)Aπ(i)=Aπ(i)Aπ(i+1) for all i. Thus, if Aπ(1) is k vertices clockwise of Aπ(0), then Aπ(2) is k vertices clockwise of Aπ(1), and so on all the way up to Aπ(n−1) being k vertices clockwise of Aπ(n). This is only possible if k is relatively prime to n, so there are φ(n) choices of k. There are n choices of the place to put Aπ(1), giving nφ(n) choices of permutations meeting this condition. It is clear that each permutation meeting this condition provides the same tournament, so the n! permutations can be partitioned into equivalence classes of size nφ(n) each. Thus, there are nφ(n)n! distinct equivalence classes, and we are done.