Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <fstream>
- #include <set>
- using namespace std;
- int main()
- {
- int odd = 0;
- int even = 0;
- int x, y;
- cin >> y;
- for (int i = 0; i < y; i++) {
- cin >> x;
- if (x % 2 == 0) even++;
- else odd++;
- }
- while (odd > even) {
- odd--;
- odd--;
- even++;
- }
- if (even > odd + 1)even = odd + 1;
- cout << even + odd;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement