#include <bits/stdc++.h>
using namespace std;
long long i, j, n, k, s[100001], sum1 = 0, sum2 = 0, m;
vector<long long> a, b;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> k;
    s[k] = i + 1;
  }
  cin >> m;
  for (i = 0; i < m; i++) {
    cin >> k;
    sum1 = sum1 + s[k];
    sum2 = sum2 + n - s[k] + 1;
  }
  cout << sum1 << " " << sum2;
  return 0;
}
