#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, e, f, g;
  vector<int> v1, v2;
  while (cin >> a) {
    for (b = 1; b <= a; b++) {
      cin >> c;
      v1.push_back(c);
    }
    v2 = v1;
    sort(v1.begin(), v1.end());
    reverse(v1.begin(), v1.end());
    for (b = 1; b <= a; b++) {
      d = 0;
      for (c = 0; c < v1.size(); c++) {
        if (v1[c] != 0 && v1[c] % 2 != 0 && b % 2 != 0) {
          v1[c] = 0;
          d = 1;
          break;
        } else if (v1[c] != 0 && v1[c] % 2 == 0 && b % 2 == 0) {
          v1[c] = 0;
          d = 1;
          break;
        }
      }
      if (d == 0) {
        break;
      }
    }
    e = 0;
    for (c = 0; c < v1.size(); c++) {
      e += v1[c];
    }
    cout << e << endl;
    v1.clear();
    v2.clear();
  }
  return 0;
}
