1 of 3

05AB1E, 15 bytes

0-indexed.

11Iµ11N*DÂQNp*½

Try it online!