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