#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
const int MAXD = 210;
pair<int, int> a[MAXN];
int cnt[MAXD];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].first;
  for (int i = 0; i < n; i++) {
    cin >> a[i].second;
    cnt[a[i].second]++;
  }
  sort(a, a + n);
  int j = n - 1;
  int cur = 0;
  int ans = n * 200;
  for (int i = n - 1; i >= 0; i--) {
    while (j >= 0 && a[i].first == a[j].first) {
      cnt[a[j].second]--;
      j--;
    }
    int have = i - j;
    int del = max(0, i + 1 - 2 * have + 1);
    int tmp = cur;
    for (int p = 1; p <= 200; p++) {
      tmp += min(del, cnt[p]) * p;
      del -= min(del, cnt[p]);
    }
    ans = min(ans, tmp);
    cur += a[i].second;
  }
  cout << ans << endl;
}
