added perm coutning