#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> v(100001, -1);
  cin >> n;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    v[x] = i + 1;
  }
  int m;
  cin >> m;
  long long ans = 0;
  long long revans = 0;
  for (int i = 0; i < m; i++) {
    cin >> x;
    ans += v[x];
    revans += n - v[x] + 1;
  }
  cout << ans << ' ' << revans << endl;
}
