#include <bits/stdc++.h>
using namespace std;
const int AKA = 5e5 + 5;
int frq[AKA];
long long arr[2005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, even = 0, odd = 0, sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] % 2 == 0) even++;
    if (arr[i] % 2 == 1) odd++;
  }
  sort(arr, arr + n);
  int Min = min(odd, even) * 2;
  cout << odd << " " << even << endl;
  if (odd != even) {
    for (int i = n - 1; i < n; i--) {
      if (Min <= 0) break;
      if (arr[i] % 2 == 0) {
        arr[i] = 0;
        Min--;
      }
      if (arr[i] % 2 == 1) {
        arr[i] = 0;
        Min--;
      }
    }
    if (odd > even) {
      for (int i = n - 1; i < n; i--) {
        if (arr[i] == 0) continue;
        if (arr[i] % 2 == 1) {
          arr[i] = 0;
          break;
        }
      }
    }
    if (even > odd) {
      for (int i = n - 1; i < n; i--) {
        if (arr[i] == 0) continue;
        if (arr[i] % 2 == 0) {
          arr[i] = 0;
          break;
        }
      }
    }
    for (int i = 0; i < n; i++) sum += arr[i];
    cout << sum << endl;
  } else if (odd == even)
    cout << "0" << endl;
  return 0;
}
