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