#include <bits/stdc++.h>
using namespace std;
int a[111111], b[111111];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) scanf("%d", a + i), b[a[i]] = i;
  int m;
  cin >> m;
  long long Ans1 = 0, Ans2 = 0;
  for (int i = 1; i <= m; ++i) {
    int x;
    scanf("%d", &x);
    int ans = b[x];
    Ans1 += (long long)ans;
    Ans2 += (long long)n + 1 - ans;
  }
  cout << Ans1 << " " << Ans2 << endl;
  return 0;
}
