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