#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, v = 0, t = 0, a[100001], p;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> p;
    a[p] = i;
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> p;
    v = a[p] + v;
    t = t + n - a[p] + 1;
  }
  cout << v << " " << t;
  return 0;
}
