Arnaldo, Bernaldo, Cernaldo, Dernaldo, and Ernaldo are students from different parts of Brazil who were chosen to represent their country in international olympiads. After several weeks of training, some friendships were formed. We then asked each of them how many friends they had made in the group. Arnaldo, Bernaldo, Cernaldo, and Dernaldo answered, respectively, that they had made 1, 2, 3, and 4 friends within the group. How many of the group members are friends with Ernaldo?
Solution

Suppose Ernaldo has $x$ friends within the group. Since Dernaldo has 4 friends and the group has 5 members, everyone is a friend of Dernaldo. Let's remove Dernaldo from the group. Thus, Arnaldo, Bernaldo, Cernaldo, and Ernaldo now have $0, 1, 2$, and $x-1$ friends within the subgroup, respectively. Since Arnaldo no longer has any friends within the subgroup, we can ignore him. The following table shows the number of friends each member has within the subgroup.

| Member | Number of friends |
| :--- | :---: |
| Bernaldo | 1 |
| Cernaldo | 2 |
| Ernaldo | $x-1$ |

Obviously, the two friends of Cernaldo within the subgroup are Bernaldo and Ernaldo. Moreover, since Bernaldo has only one friend within the group, Cernaldo must be that friend. In particular, Ernaldo and Bernaldo are not friends. Therefore, Cernaldo is also the only friend of Ernaldo within the subgroup, i.e., $x-1=1$. We conclude that Cernaldo and Dernaldo are the only friends of Ernaldo. The answer is 2.