#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, c = 0, u = 0;
  cin >> n;
  vector<long long> arr(10000000);
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    arr[a] = i + 1;
  }
  long long t;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    long long p;
    cin >> p;
    c += arr[p];
    u += (n + 1) - arr[p];
  }
  cout << c << " " << u << endl;
}
