Find all values of the real parameter $a$, for which the system
$(|x| + |y| - 2)^2 = 1$
$y = ax + 5$
has exactly three solutions
To find all values of the real parameter \( a \) for which the system 
\[
(|x| + |y| - 2)^2 = 1 \quad \text{and} \quad y = ax + 5
\]
has exactly three solutions, we need to analyze the intersections of the line \( y = ax + 5 \) with the curves defined by the given equation.

1. **Rewrite the given equation:**
   \[
   (|x| + |y| - 2)^2 = 1
   \]
   Taking the square root on both sides, we get:
   \[
   |x| + |y| - 2 = \pm 1
   \]
   This simplifies to two cases:
   \[
   |x| + |y| = 3 \quad \text{(Case 1)}
   \]
   \[
   |x| + |y| = 1 \quad \text{(Case 2)}
   \]

2. **Analyze the intersections with \( |x| + |y| = 3 \):**
   The equation \( |x| + |y| = 3 \) represents a diamond (or square rotated by 45 degrees) centered at the origin with vertices at \((3,0)\), \((0,3)\), \((-3,0)\), and \((0,-3)\).

3. **Analyze the intersections with \( |x| + |y| = 1 \):**
   The equation \( |x| + |y| = 1 \) represents a smaller diamond centered at the origin with vertices at \((1,0)\), \((0,1)\), \((-1,0)\), and \((0,-1)\).

4. **Determine the intersections of the line \( y = ax + 5 \) with these diamonds:**
   - For the line to intersect the diamonds, it must pass through the regions defined by the diamonds.
   - The line \( y = ax + 5 \) intersects the x-axis at \( x = -\frac{5}{a} \).

5. **Count the intersections:**
   - If the line intersects the larger diamond \( |x| + |y| = 3 \) at exactly one point and the smaller diamond \( |x| + |y| = 1 \) at exactly two points, or vice versa, we will have exactly three solutions.

6. **Special cases:**
   - When \( a = \pm \frac{5}{3} \), the line \( y = ax + 5 \) intersects the larger diamond \( |x| + |y| = 3 \) at exactly one point on the x-axis.
   - When \( a = \pm 5 \), the line \( y = ax + 5 \) intersects the smaller diamond \( |x| + |y| = 1 \) at exactly one point on the x-axis and intersects the larger diamond \( |x| + |y| = 3 \) at two points.

Therefore, the values of \( a \) for which the system has exactly three solutions are:
\[
a = \pm \frac{5}{3} \quad \text{and} \quad a = \pm 5
\]

The final answer is \(\boxed{a = \pm \frac{5}{3}, \pm 5}\)