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