1. A method for storing data in a memory that includes a plurality of analog memory cells, comprising: mapping the data to programming values selected from a set of nominal programming values comprising at least a first nominal programming value and a second nominal programming value, which is higher than the first nominal programming value; storing a part of the data in the analog memory cells by programming at least a first group of the cells using the first nominal programming value; measuring a statistical characteristic of the first group of the cells after programming the first group of the cells using the first nominal programming value; modifying the second nominal programming value responsively to the statistical characteristic; and programming at least a second group of the cells using the modified second nominal programming value.