Forty teams play a tournament in which every team plays every other team exactly once.  No ties occur, and each team has a $50 \%$ chance of winning any game it plays.  The probability that no two teams win the same number of games is $m/n,$ where $m$ and $n$ are relatively prime positive integers.  Find $\log_2 n.$
1. **Determine the total number of games played:**
   Since there are 40 teams and each team plays every other team exactly once, the total number of games played is given by the combination formula:
   \[
   \binom{40}{2} = \frac{40 \times 39}{2} = 780
   \]

2. **Calculate the probability of a specific arrangement:**
   Each game has a 50% chance of being won by either team. Therefore, the probability of any specific arrangement of wins and losses for all 780 games is:
   \[
   \left(\frac{1}{2}\right)^{780} = \frac{1}{2^{780}}
   \]

3. **Determine the number of ways to order the teams:**
   If no two teams win the same number of games, the number of ways to order the teams such that each team has a unique number of wins is:
   \[
   40!
   \]

4. **Calculate the total probability:**
   The total probability that no two teams win the same number of games is the product of the probability of a specific arrangement and the number of ways to order the teams:
   \[
   \frac{40!}{2^{780}}
   \]

5. **Simplify the expression:**
   To simplify the expression, we need to determine the number of factors of 2 in \(40!\). Using de Polignac's (Legendre's) formula, the number of factors of a prime \(p\) in \(n!\) is given by:
   \[
   \sum_{k=1}^{\infty} \left\lfloor \frac{n}{p^k} \right\rfloor
   \]
   For \(p = 2\) and \(n = 40\):
   \[
   \left\lfloor \frac{40}{2} \right\rfloor + \left\lfloor \frac{40}{4} \right\rfloor + \left\lfloor \frac{40}{8} \right\rfloor + \left\lfloor \frac{40}{16} \right\rfloor + \left\lfloor \frac{40}{32} \right\rfloor = 20 + 10 + 5 + 2 + 1 = 38
   \]

6. **Adjust the denominator:**
   The number of factors of 2 in \(40!\) is 38, so the denominator \(2^{780}\) can be adjusted by removing these factors:
   \[
   \frac{40!}{2^{780}} = \frac{40!}{2^{38} \cdot 2^{742}} = \frac{40!}{2^{38}} \cdot \frac{1}{2^{742}}
   \]
   Since \(40!\) is an integer, the remaining denominator is:
   \[
   2^{742}
   \]

7. **Find \(\log_2 n\):**
   The value of \(n\) in the simplified fraction is \(2^{742}\), so:
   \[
   \log_2 n = \log_2 (2^{742}) = 742
   \]

The final answer is \(\boxed{742}\)