#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 9);
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    a[x] = i;
  }
  int m;
  cin >> m;
  long long sum = 0, add = 0;
  for (int i = 0; i < m; i++) {
    int y;
    cin >> y;
    sum += a[y];
    add += n - a[y] + 1;
  }
  cout << sum << " " << add << endl;
  return 0;
}
