#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
void solve() {
  long long n, m, i, one, two, p, temp;
  cin >> n;
  int x[100005] = {0};
  for (i = 1; i <= n; i = i + 1) {
    cin >> p;
    x[p] = i;
  }
  cin >> m;
  one = two = 0;
  for (i = 1; i <= m; i = i + 1) {
    cin >> p;
    one += x[p];
    two += (n - x[p]) + 1;
  }
  cout << one << " " << two << "\n";
}
int main() {
  long long t = 1;
  for (int love = 1; love <= t; love++) {
    solve();
  }
  return 0;
}
