compress perm input check to a for loop