#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long m;
  cin >> m;
  long long b[m];
  for (long long i = 0; i < m; i++) {
    cin >> b[i];
  }
  int aa[n];
  long long pa = 0;
  long long pb = 0;
  for (long long i = 0; i < n; i++) {
    aa[a[i] - 1] = i + 1;
  }
  for (long long i = 0; i < m; i++) {
    pa += (aa[b[i] - 1]);
  }
  for (long long i = 0; i < m; i++) {
    pb += (n - aa[b[i] - 1] + 1);
  }
  cout << pa << " " << pb;
}
