Find magic index.