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