So I have two arrays $d$ and $s$ with size $n \in \mathbb{N}$. Array $d$ contains the elements and array $s$ contains indices. Array $s$ contains all numbers from $0$ upto $n$ with no duplicates.
The indices in $s$ indicate where the elements in $d$ need to go. So the element at $d[q]$ needs to be at $d[s[q]]$ where $n > q \geq 0$.
The goal is to find the minimum amount of $q \in \mathbb{N}$ swaps such that the after all swaps are performed the above holds.