Shapovalov A.V.

The host has a deck of 52 cards. The audience wants to know the order in which the cards are arranged (without specifying whether it is from top to bottom or from bottom to top). They are allowed to ask the host questions of the form "How many cards lie between such-and-such and such-and-such cards?" One of the audience members peeked and saw the order of the cards. What is the minimum number of questions he must ask so that the other audience members can determine the order of the cards in the deck based on the answers to these questions?
Algorithm. Let's show how to establish the order of cards in 34 questions. We will divide all the cards in the deck (numbered from bottom to top), except the 19th, into triples:

| The cards | 1 | 2 | 3 | $\ldots$ | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | $\ldots$ | 48 | 49 | 50 | 51 | 52 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| The triples | 1 | 2 | 3 | $\ldots$ | 16 | 17 | 1 | $*$ | 17 | 17 | 16 | 16 | $\ldots$ | 3 | 3 | 2 | 2 | 1 |

In each triple, we will determine the distances between the outer cards and between the lower and middle cards with two questions. After this, it is clear that:

1) The 1st and 52nd cards are the outermost in the deck. By the condition, we can assume that the 1st card is the bottom one, and the 52nd is the top one. In this case, the 18th card will also be in its place.
2) Each subsequent triple "fits tightly" into the previous one. A priori, this can be done in two ways. The middle card of the triple (in all triples except the first) adjoins the corresponding outer card (these two cards are called the thick end).
3) Between the ends of the 17th triple, there are still two places. This triple is inserted into all previous ones, so these places are "occupied" by the 18th and 19th cards. That is, the 18th card is inside the 17th triple and, therefore, inside all previous triples.

Since there are only 17 places below the 18th card, they are occupied by the thin ends of all triples. Thus, the arrangement of the cards is uniquely restored as indicated in the table.

Estimate. Initially, we divide all the cards into 52 groups of one card each. When asking about two cards from different groups, we merge these groups. Thus, each question reduces the number of groups by at most one. If no more than 33 questions are asked, at least 19 groups will remain. Among them, there are no more than 17 groups of three (or more) cards. Therefore, either there will be a group of two cards, or two groups of one card each. In both cases, we can swap this pair of cards without affecting the others: in this case, all the answers will remain unchanged. Thus, the order is not uniquely restored.

## Answer

34 questions.