#include <stdio.h>

int main() {
    int f, e[3], aux=0;
    scanf("%d", &f);
    for(int i=0; i<3; i++){
        scanf("%d", &e[i]);
    }
    for(int i=0; i<3-1; i++){
        for(int j=0; j<3-1-i; j++){
            if(e[j]>e[j+1]){
               aux=e[j];
               e[j]=e[j+1];
               e[j+1]=aux;
            }
        }
    }


    if(f >= e[0]+e[1]+e[2]){
        printf("3");
    }
    else if(f >= e[0]+e[1]){
        printf("2");
    }
    else if(f >= e[0] ){
        printf("1");
    }
    else{
        printf("0");
    }
        
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: