#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  while (cin >> a) {
    map<int, int> m, n;
    int mmm = 0, nnn = 0;
    m.clear();
    n.clear();
    for (int i = 0; i < a; i++) {
      int x;
      cin >> x;
      if (x & 1) {
        m[x]++;
        mmm++;
      } else {
        n[x]++;
        nnn++;
      }
    }
    cout << mmm << " " << nnn << endl;
    if (abs(mmm - nnn) <= 1) {
      cout << 0 << "\n";
    } else {
      long long sum = 0;
      if (mmm > nnn) {
        int k = 0;
        for (map<int, int>::iterator it = m.begin();
             it != m.end(), k < mmm - nnn - 1; it++) {
          while (it->second && k < mmm - nnn - 1) {
            sum += it->first;
            it->second--;
            k++;
          }
        }
      } else {
        int k = 0;
        for (map<int, int>::iterator it = n.begin();
             it != n.end(), k < nnn - mmm - 1; it++) {
          while (it->second && k < nnn - mmm - 1) {
            sum += it->first;
            it->second--;
            k++;
          }
        }
      }
      cout << sum << endl;
    }
  }
}
