#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> arr(100001);
  for (long long int i = 0; i < n; i++) {
    long long int val;
    cin >> val;
    arr[val] = i + 1;
  }
  long long int m;
  cin >> m;
  long long int count_L = 0, count_R = 0;
  for (long long int i = 0; i < m; i++) {
    long long int q;
    cin >> q;
    count_L += arr[q];
    count_R += n - arr[q] + 1;
  }
  cout << count_L << " " << count_R << "\n";
  return 0;
}
