private static int solve(LinkedList<Integer> p, int times) {
		reverseSort(p);
		int first = p.getFirst();
		if (first < times) return first;
		if (first < 4) return first;
		else {
			int min = first;
			for (int i = 3; i <= first / 2; i++) {
				LinkedList<Integer> newP = new LinkedList<Integer>();
				newP.addAll(p);
				reverseSort(newP);
				newP.remove(0);
				newP.add(i);
				newP.add(first - i);
				int temp = solve(newP, times + 1) + 1;
				if (temp < min) min = temp;
			}
			return min;
		}
	}