#include <bits/stdc++.h>
const double pi = 3.14159265358979323846;
const int M = 1000000007;
using namespace std;
int binsearch(vector<pair<int, int> >& arr, int a) {
  int n = arr.size(), pointer = 0;
  for (int i = n / 2; i >= 1; i /= 2) {
    while (i + pointer < n && arr[i + pointer].first <= a) pointer += i;
  }
  if (arr[pointer].first == a) return pointer;
  return -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<pair<int, int> > a(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[i] = make_pair(x, i);
  }
  sort(a.begin(), a.end());
  int m;
  long long v = 0, p = 0;
  int q, pointer;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> q;
    pointer = binsearch(a, q);
    pointer = a[pointer].second;
    v += (pointer + 1);
    p += (n - pointer);
  }
  cout << v << " " << p << "\n";
  return 0;
}
