#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, x, m;
  long long v = 0, p = 0;
  cin >> n;
  int arr[n];
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    mp[arr[i]] = i;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> x;
    v += mp[x] + 1;
    p += (n - mp[x]);
  }
  cout << v << ' ' << p;
  return 0;
}
