#include <bits/stdc++.h>
using namespace std;
void cases() {
  long long int n;
  cin >> n;
  unordered_map<long long int, long long int> mpx;
  unordered_map<long long int, long long int> mpy;
  for (long long int i = 0; i < n; i++) {
    long long int k;
    cin >> k;
    mpx[k] = (i + 1);
    mpy[k] = n - i;
  }
  long long int q;
  cin >> q;
  long long int ans1 = 0;
  long long int ans2 = 0;
  while (q--) {
    long long int k;
    cin >> k;
    ans1 += mpx[k];
    ans2 += mpy[k];
  }
  cout << ans1 << " " << ans2 << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int test = 1;
  for (long long int tc = 0; tc < test; tc++) {
    cases();
  }
  return 0;
}
