cppOlimp/monetki.cpp

30 lines
456 B
C++
Raw Normal View History

2022-02-07 22:33:05 +03:00
//acmp.ru 0106 moentki.cpp 8%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int num;
scanf("%i", &num);
int arr[num], c0 = 0, c1 = 0;
for(int i = 0; i < num; i++){
scanf("\n%i", &arr[i]);
}
for(int i = 0; i < num; i++){
if(arr[i] == 0){
c0 = c0 + 1;
}else if (arr[i] == 1){
c1 = c1 + 1;
}
}
if (c0 > c1){
printf("%i", c1);
}else if (c1 > c0){
printf("%i", c0);
}
}