#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  long long comp[100005];
  memset(comp, 0, sizeof(comp));
  for (long long i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    comp[a] = i;
  }
  int m;
  long long sasha = 0;
  long long vasya = 0;
  cin >> m;
  for (long long i = 1; i <= m; i++) {
    long long b;
    cin >> b;
    sasha += (n - comp[b] + 1);
    vasya += comp[b];
  }
  cout << vasya << " " << sasha << endl;
}
