Created
August 24, 2021 01:16
-
-
Save esthicodes/0f2b09f85fa4caa4405389a45f03043e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
#include <stdlib.h> | |
int main() { | |
int n; | |
scanf("%d",&n); | |
int arr[101]; | |
for(int i=0;i<101;i++){ | |
arr[i]=0; | |
} | |
for(int i=0;i<n;i++){ | |
int j; | |
scanf("%d",&j); | |
arr[j] += 1; | |
} | |
int total=0; | |
for(int i=0;i<101;i++){ | |
if(arr[i]> 1){ | |
if(arr[i] % 2 == 0) total += (arr[i] / 2); | |
else total += ((arr[i]-1) / 2); | |
} | |
} | |
printf("%d",total); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment