See my comment earlier about using $DEIS_NUM_INSTANCES to set this variable instead, as per our standard across all providers.