#include <bits/stdc++.h>
using namespace std;
struct abc {
  long long first;
  long long second;
};
bool comp(abc a, abc b) { return a.second < b.second; }
int main() {
  long long n, cnt = 0;
  cin >> n;
  abc a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i].second;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first;
  }
  sort(a + 1, a + n + 1, comp);
  for (long long i = 1; i <= n; i++) {
    for (long long j = i + 1; j <= n; j++) {
      if ((a[i].first >= 0 and a[j].first >= 0) or
          (a[i].first <= 0 and a[j].first <= 0)) {
        if (a[i].first <= a[j].first and a[i].second != a[j].second) {
          cnt += j - i;
        }
      } else if (a[i].first == 0 and a[j].first >= 0)
        cnt += j - i;
      else if (a[i].first != 0 and a[j].first != 0)
        cnt += j - i;
    }
  }
  cout << cnt << endl;
  return 0;
}
