Problem

Source: Brazil National Olympiad 2019 #2

Tags: combinatorics



Given are the real line and the two unique marked points $0$ and $1$. We can perform as many times as we want the following operation: we take two already marked points $a$ and $b$ and mark the reflection of $a$ over $b$. Let $f(n)$ be the minimum number of operations needed to mark on the real line the number $n$ (which is the number at a distance $\left| n\right|$ from $0$ and it is on the right of $0$ if $n>0$ and on the left of $0$ if $n<0$). For example, $f(0)=f(1)=0$ and $f(-1)=f(2)=1$. Find $f(n)$.