#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> solve(vector<int> arr, int n, vector<int> q, int m) {
  vector<int> comparisons(n + 1);
  int comp = 0;
  for (int i = 0; i < n; i++) comparisons[arr[i]] = ++comp;
  long long a = 0;
  long long b = 0;
  for (int i = 0; i < m; i++) {
    a += comparisons[q[i]];
    b += n - comparisons[q[i]] + 1;
  }
  return make_pair(a, b);
}
int main() {
  int n, m;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  cin >> m;
  vector<int> q(m);
  for (int i = 0; i < m; i++) cin >> q[i];
  auto res = solve(arr, n, q, m);
  cout << res.first << " " << res.second << endl;
  return 0;
}
