5. In a group of 2017 people, any two people have exactly one common friend (excluding the two people themselves). Determine the minimum possible value of the difference between the number of friends of the person with the most friends and the person with the least friends in this group.
5. Let $a$ and $b$ not be friends. If $x$ is a friend of $a$, then $x$ and $b$ have exactly one common friend $y$.

Consider the mapping from $a$'s friends to $b$'s friends: $x \mapsto y$. It is easy to verify that this is a bijection. Therefore, any two non-friends have the same number of friends.

Now, for a positive integer $k$, consider the set of people who have exactly $k$ friends and its complement. Then, two people from these two sets are friends. Thus, at least one of the sets has fewer than 2 elements. Hence, either there is a person who is friends with everyone, or everyone has the same number of friends.

Assume that everyone has exactly $k$ friends. Considering the number of pairs of friends, we get $\mathrm{C}_{2017}^{2}=2017 \mathrm{C}_{k}^{2}$, which has no solution.

Therefore, there is a person $a_{1}$ who is friends with everyone. And for $1 \leqslant i \leqslant 1008, a_{2 i}$ and $a_{2 i+1}$ are friends, which is a situation that satisfies the problem.
Thus, the answer is $2016-2=2014$.