Part of 2024 Lusophon Mathematical Olympiad
Source: Lusophon Mathematical Olympiad 2024 Day 2 Problem 4