public int getCount(int[] luckySet, int n) {
		Arrays.sort(luckySet);
		int first = 0;
		int last = 0;

		if (n < luckySet[0]) {
			first = 0;
			last = luckySet[0];
		} else {
			for (int i = 0; i < luckySet.length - 1; i++) {
				if (luckySet[i] < n && n < luckySet[i + 1]) {
					first = luckySet[i];
					last = luckySet[i + 1];
					break;
				}
			}
			if (last==0){
				return 0;
			}
		}

		return (n - first - 1) + (last - n - 1) + (n - first - 1)
				* (last - n - 1);
	}