#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unordered_map<int, int> mp(n);
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    mp[x] = i;
  }
  int t;
  cin >> t;
  long long p = 0, s = 0;
  while (t--) {
    int f;
    cin >> f;
    int pos = mp[f];
    p += pos;
    s += (n - pos + 1);
  }
  cout << p << " " << s;
  return 0;
}
