Problem

Source: 2023 IGMO Christmas Edition #4 International Gamma Mathematical Olympiad

Tags: number theory, combinatorics



We say that a non-empty set $A \subset Z$ is weird if and only if $$\left( \sum_{a \in A} a - |A| \right) \in A.$$Santa has $n$ elves, where $n$ is a fixed positive integer greater than or equal to $2$. Santa assigns each one of his $n$ elves a positive integer from $1$ up to $n$. Santa wants to ask some of the elves to create toys but he notices that if the set of elves that works on creating toys has a weird subset, they become lazy and inefficient. What is the maximal set (in terms of cardinality) of elves that can work simultaneously on crafting toys and stay efficient at the same time?