#include <bits/stdc++.h>
using namespace std;
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.second == b.second) return (a.first > b.first);
  return (a.second > b.second);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, v = 0, p = 0;
  cin >> n;
  map<long long, long long> m;
  for (long long i = 0; i < n; i++) {
    long long r;
    cin >> r;
    m[r] = i + 1;
  }
  long long t = 1;
  cin >> t;
  while (t--) {
    long long u;
    cin >> u;
    v += (m[u]);
    p += (n + 1 - m[u]);
  }
  cout << v << " " << p;
  return 0;
}
