#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c;
  long long cnt1 = 0, cnt2 = 0;
  cin >> n;
  int* arr = new int[100000];
  for (int i = 1; i <= n; i++) {
    cin >> c;
    arr[c] = i;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> c;
    cnt1 += arr[c];
    cnt2 += n - arr[c] + 1;
  }
  cout << cnt1 << " " << cnt2 << endl;
}
