#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int num, i, j, sortt, cart, tt, k, l, r;
  string s;
  cin >> num;
  long long int a[num];
  map<long long int, long long int> m;
  i = 0;
  while (i < num) {
    cin >> a[i];
    m[a[i]] = i;
    i++;
  }
  cin >> k;
  sortt = 0;
  cart = 0;
  while (k--) {
    cin >> l;
    sortt += m[l] + 1;
    cart += num - m[l];
  }
  cout << sortt << " " << cart << "\n";
  return 0;
}
