I have seen a version of this somewhere and so I got interested. I will be happy to see how does mathematicians think of questions like this as to formulate an elegant proof. (I would be very happy if it will turn out as elegant as possible). Now, lets begin with all the fun:
Let $n$ be an integer.
Consider $(\mathbb{Z}_2,+,\times)$ when $\mathbb{Z}_2$ is a field over elements $\{0,1\}$ with $+$ and $\times$ the addition and multiplication operations in modular-2 arithmetic respectively.
$\mathbb{Z}_2^n$ is defined to be the set $\{v=(v_0,v_1,...,v_{n-1})|\forall i < n (v_i \in \mathbb{Z}_2)\}$.
Let $i < n$ be an integer. Define $T_i:\mathbb{Z}_2^{n} \rightarrow \mathbb{Z}_2^{n}$ such that for each integer $j < n$ and for each $v \in \mathbb{Z}_2^n$, $(T_i(v))_j = v_j+\delta_{ij}$.
For a function $F: D \rightarrow I$ and $A \subseteq I$ we define $F^{-1}(A) = \{x \in D | F(x) \in A \}$
Prove that there exists $f:\mathbb{Z}_2^{n} \rightarrow \{0,1,...,n-1\}$ such that for every integer $i < n$ and for every $v \in \mathbb{Z}_2^{n}$, for $W={T_i^{-1}\{v\}}$, $f|_W$ is an injection if and only if there exists an integer $m$ such that $n = 2^m$.