position diff should be <= n