#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  unordered_map<long long, long long> m;
  for (long long i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    m[a] = i;
  }
  long long q;
  cin >> q;
  long long d = 0, e = 0;
  for (long long i = 0; i < q; i++) {
    long long b;
    cin >> b;
    d += m[b];
    e += n - m[b] + 1;
  }
  cout << d << ' ' << e << endl;
  return 0;
}
