b=({1..1000}) read n for((i=1;i<=n;++i)){ echo \? $[n-1] ${b[@]::i-1} ${b[@]:i:n-i} read r ((r))||a+=($i) } echo ! ${#a[@]} ${a[@]}