#include <stdio.h>
int f[1000100];

int main() {
    int C, soma=0;
    scanf("%d", &C);

    int v[C];
    for(int i=0; i<C; i++){
        scanf("%d", &v[i]);
    }
    for(int i=0; i<C; i++){
        f[v[i]]++;
    }
    for(int j=0; j<1000000; j++){
        if(f[j]%2==0){
            soma=soma+f[j];
        }
        else if(f[j]%2==1){
            soma = soma + f[j]+1; 
        }
    }
    
    printf("%d", soma);
    return 0;
}

Embed on website

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