public class Test07 {
	public static void main(String[] args) {
		int Lm, n, j, sum, k, r;
		Lm = 0;
		for (n = 4; n <= 1000; n++)
		{
			sum = 0;
			k = n / 2;
			for (j = 1; j <= k; j++)
			{
				r = n % j;
				if (r == 0)
					sum += j;
			}
			if (n == sum)
			{
				System.out.printf("%d ", n);
				Lm++;
			}
		}
		System.out.printf("%d", Lm);
	}
}
