Rename local variable

Rename local variable from 'n' to 'i' because it's an index.