Problem

Source: Indonesian MO 2016 Problem #8

Tags: permutations, combinatorics, number theory



Determine with proof, the number of permutations $a_1,a_2,a_3,...,a_{2016}$ of $1,2,3,...,2016$ such that the value of $|a_i-i|$ is fixed for all $i=1,2,3,...,2016$, and its value is an integer multiple of $3$.