#include <bits/stdc++.h>
using namespace std;
int n, m;
int position[100005];
int main(void) {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int k;
    cin >> k;
    position[k] = i;
  }
  cin >> m;
  long long int lsum = 0, rsum = 0;
  for (int i = 0; i < m; i++) {
    int k;
    cin >> k;
    lsum += (long long)position[k];
    rsum += (long long)n + 1 - position[k];
  }
  cout << lsum << " " << rsum;
}
