public static void CC18_4(int n) {//PASS
		//check parameter
		if(n<0) {
			System.out.println ("invalid input number");
			return;
		}
		//allocate the array to store digits.
		int temp = n;
		int num_of_digits = 0;
		while(temp != 0) {
			temp = temp/10;
			num_of_digits++;
		}
		int[] arr = new int[num_of_digits];
		int[] sum_temp = new int[num_of_digits];
		System.out.println("The number of digits is: " + num_of_digits);
		//convert the integer to array
		temp = n;
		int sum = 0;
		for (int i=0; i<num_of_digits; ++i) {
			arr[i] = temp%10;
			temp = temp/10;
		}
		
		for (int i=0; i<num_of_digits; ++i) {
			int pow10 = (int)Math.pow(10, i);//the liangji
			sum_temp[i] = n/(10*pow10)*pow10;
			if (arr[i] == 2) {
				sum_temp[i] += (n+1-n/pow10*pow10);
			}
			else if (arr[i] > 2) sum_temp[i] += pow10;
			sum += sum_temp[i];
		}
		System.out.println (sum);

	}