#!/usr/local/bin/perl sub shady { $==(shift)-1, scalar split/ /, join ' ', map{$=|=$=>>$_} grep{$/=$$/=$$/$^F,!((log)/log($/))?1:int((log)/log($/))==((log)/log($/))} (1..24) and $==(pop)+1; } print shady(shift), "\n";