Permutations and quantum entanglement