Suppose you are given that for some positive integer $n$, $1! + 2! + \ldots + n!$ is a perfect square. Find the sum of all possible values of $n$.
1. We start by examining the sum of factorials for small values of \( n \) to determine if the sum is a perfect square. We will check \( n = 1, 2, 3 \) and then analyze the behavior for \( n \geq 4 \).

2. For \( n = 1 \):
   \[
   1! = 1
   \]
   Since \( 1 \) is a perfect square (\( 1^2 = 1 \)), \( n = 1 \) works.

3. For \( n = 2 \):
   \[
   1! + 2! = 1 + 2 = 3
   \]
   Since \( 3 \) is not a perfect square, \( n = 2 \) does not work.

4. For \( n = 3 \):
   \[
   1! + 2! + 3! = 1 + 2 + 6 = 9
   \]
   Since \( 9 \) is a perfect square (\( 3^2 = 9 \)), \( n = 3 \) works.

5. Now, we need to check if \( n \geq 4 \) can result in the sum being a perfect square. We will analyze the last digit of the sum \( 1! + 2! + \ldots + n! \) for \( n \geq 4 \).

6. For \( n \geq 4 \), the factorials \( 4! \) and higher end in zero because they include the factor \( 10 \) (i.e., \( 4! = 24 \), \( 5! = 120 \), etc.). Therefore, the last digit of the sum \( 1! + 2! + 3! + 4! + \ldots + n! \) is determined by the last digit of \( 1! + 2! + 3! \):
   \[
   1! + 2! + 3! = 1 + 2 + 6 = 9
   \]
   The last digit of the sum is 9 for \( n \geq 4 \).

7. A perfect square cannot end in 3, 7, or 8. Since the last digit of the sum for \( n \geq 4 \) is 9, we need to check if it can be a perfect square. However, the sum \( 1! + 2! + 3! + 4! + \ldots + n! \) for \( n \geq 4 \) will always end in 3 (since the sum of the digits 1, 2, 6, and 4 ends in 3), which cannot be a perfect square.

8. Therefore, the only possible values of \( n \) that make the sum a perfect square are \( n = 1 \) and \( n = 3 \).

9. The sum of all possible values of \( n \) is:
   \[
   1 + 3 = 4
   \]

The final answer is \(\boxed{4}\).