#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int *arr = new int[n];
  int *pos = new int[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    pos[arr[i]] = i;
  }
  int t;
  cin >> t;
  long long count1 = 0;
  long long count2 = 0;
  while (t--) {
    int x;
    cin >> x;
    count1 += pos[x] + 1;
    count2 += (n - 1 - pos[x]) + 1;
  }
  cout << count1 << " " << count2;
  return 0;
}
