Count permutations of [1, 2, ..., n] where each number at position i satisfies: num % i == 0 or i % num == 0.
Example: n=2. Permutations: [1,2] (1%1=0, 2%2=0), [2,1] (2%1=0, 1%2≠0). Count = 2.
Hint: Backtracking with early termination when the constraint is violated.