public int firstMissingPositive(int[] A) {
		// IMPORTANT: Please reset any member data you declared, as
		// the same Solution instance will be reused for each test case.
		int N = 0;
		for (int i = 0; i < A.length; ++i) {
			if (A[i] > 0) {
				A[N++] = A[i];
			}
		}
		for (int i = 0; i < N; ++i) {
			int trial = A[i];
			if (trial != (i + 1)) {
				while (trial <= N) {
					int tmp = A[trial - 1];
					A[trial - 1] = trial;
					if (trial == tmp) {
						break;
					}
					trial = tmp;
				}
			}
		}
		int i = 0;
		for (; i < N; ++i) {
			if (A[i] != (i + 1)) {
				break;
			}
		}
		return i + 1;
	}