#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int arr[100001];
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    arr[temp] = i;
  }
  int m;
  cin >> m;
  long long vasya = 0;
  long long petya = 0;
  while (m--) {
    int temp;
    cin >> temp;
    vasya += arr[temp] + 1;
    petya += n - arr[temp];
  }
  cout << vasya << " " << petya << endl;
  return 0;
}
