The Matini company released a special album with the flags of the $ 12$ countries that compete in the CONCACAM Mathematics Cup. Each postcard envelope has two flags chosen randomly. Determine the minimum number of envelopes that need to be opened to that the probability of having a repeated flag is $50\%$.
1. **Define the problem and the variables:**
   - We have 12 different flags.
   - Each envelope contains 2 flags chosen randomly.
   - We need to determine the minimum number of envelopes to be opened such that the probability of having at least one repeated flag is at least 50%.

2. **Calculate the probability of all flags being different:**
   - Let \( k \) be the number of envelopes opened.
   - Each envelope contains 2 flags, so \( 2k \) flags are chosen in total.
   - The total number of ways to choose \( 2k \) flags from 12 flags without repetition is given by:
     \[
     \frac{12!}{(12-2k)!}
     \]
   - The total number of ways to choose \( 2k \) flags with repetition allowed is \( 12^{2k} \).

3. **Probability of all flags being different:**
   - The probability that the first \( 2k \) flags are all different is:
     \[
     P(\text{all different}) = \frac{12 \times 11 \times 10 \times \cdots \times (12 - 2k + 1)}{12^{2k}}
     \]

4. **Set up the inequality for the probability:**
   - We need this probability to be less than 50%:
     \[
     \frac{12 \times 11 \times 10 \times \cdots \times (12 - 2k + 1)}{12^{2k}} < 0.5
     \]

5. **Compute the probabilities for different values of \( k \):**
   - For \( k = 1 \):
     \[
     P(\text{all different}) = \frac{12 \times 11}{12^2} = \frac{11}{12} \approx 0.9167
     \]
   - For \( k = 2 \):
     \[
     P(\text{all different}) = \frac{12 \times 11 \times 10 \times 9}{12^4} = \frac{11880}{20736} \approx 0.5735
     \]
   - For \( k = 3 \):
     \[
     P(\text{all different}) = \frac{12 \times 11 \times 10 \times 9 \times 8 \times 7}{12^6} = \frac{665280}{2985984} \approx 0.2229
     \]

6. **Determine the minimum \( k \) such that the probability is less than 50%:**
   - From the calculations above, we see that for \( k = 2 \), the probability is approximately 0.5735, which is greater than 50%.
   - For \( k = 3 \), the probability is approximately 0.2229, which is less than 50%.

Therefore, the minimum number of envelopes that need to be opened to have a probability of at least 50% of having a repeated flag is \( k = 3 \).

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