#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  int m;
  cin >> m;
  long long int l = 0, r = 0;
  while (m--) {
    int b;
    cin >> b;
    l += a[b].second;
    r += (n - a[b].second + 1);
  }
  cout << l << ' ' << r;
  return 0;
}
