import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int count =0; for (int i = 1; i <= n; i++) { if (isPerfect(i)){ count++; } } System.out.println(count); } //判断是否是完全数 public static boolean isPerfect(int num){ int sum =0; for (int i = 1; i < num; i++) { if (num%i==0){ sum+=i; } } return sum==num; } }