Anagram invariant