nsamples function

Number of samples