where N is a number of unique transmitters in the measurement.  After sorting the tagged fingerprints according to the distances Di from the measured fingerprint, the first fingerprints are chosen. From their positions the weighted estimate of a position of the measured fingerprint is calculated according to the formula in Figure 21.