def getClosest(data,value):
	"""
	Finds the index of the closest element to value in data. Data should be ordered.
	"""
	data.sort()
	i = 0
	lgt = len(data)
	while i < lgt and value > data[i]:
		i+=1
	return i if i <lgt  else lgt-1