#include<stdio.h> int main() { long n; long count,sum; while(scanf("%ld\n",&n)!=EOF) { count=0; for(long i=1;i<=n;i++) { sum=0; for(long j=1;j<i;j++) { if(i%j==0) sum+=j; } if(i==sum) count++; } printf("%ld\n",count); } }
#include<stdio.h> int main() { long n; long count,sum; while(scanf("%ld\n",&n)!=EOF) { count=0; for(long i=1;i<=n;i++) { sum=0; for(long j=1;j<i;j++) { if(i%j==0) sum+=j; } if(i==sum) count++; } printf("%ld\n",count); } }