## Task A-1.7.

Ivica and Marta have two identical sets of fifty cards with different symbols. Each of them shuffles their set of cards. Then Ivica puts his set of cards on the table, and then Marta puts her cards on top of Ivica's. Ivica then counts how many cards are between each pair of identical cards, for each of the 50 pairs of identical cards, and adds up the resulting numbers. What are all the possible results Ivica can get?
## First Solution.

First, we will show that the result does not change if two cards in Ivica's set are swapped.

Suppose that two cards are swapped, being "distant" by $k$ places (with $k-1$ cards in between). Let the symbol on the first of these cards be $A$, and the symbol on the second card be $B$. Then, the number of places between the two cards $A$ (from Ivica's and Martina's sets) has decreased by $k$, but the number of cards between the two cards $B$ has increased by $k$. Thus, the total result has not changed.

Similarly, it can be shown that the result does not change if two cards in Martina's set are swapped.

1 point

This actually means that the result does not depend on the order of the cards, as any order of the cards can be obtained by successive swaps of two cards.

We will choose the simplest possible: the order of the cards in Ivica's set is the same as the order of the cards in Martina's set. In this case, there are exactly 49 cards between each pair of identical cards, so the desired result is $49 \cdot 50=2450$.