#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  unordered_map<long long int, long long int> m;
  for (long long int i = 0; i < n; i++) {
    long long int ele;
    cin >> ele;
    m[ele] = i;
  }
  long long int a = 0, b = 0;
  long long int q;
  cin >> q;
  while (q--) {
    long long int e;
    cin >> e;
    a += m[e] + 1;
    b += n - m[e];
  }
  cout << a << " " << b << "\n";
}
