#include <bits/stdc++.h>
using namespace std;
long double PI = 3.14159265359;
long long const oo = 1e17;
void BEGIN() {
  ios::sync_with_stdio(false);
  cin.tie(0);
}
int n, m, x;
void solve() {
  cin >> n;
  vector<pair<int, int>> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i].first;
    v[i].second = i;
  }
  sort((v.begin()), (v.end()));
  cin >> m;
  long long cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < m; i++) {
    int l = 0, r = n - 1, ans, mid;
    cin >> x;
    while (l <= r) {
      mid = l + (r - l) / 2;
      if (v[mid].first < x) {
        l = mid + 1;
      } else if (v[mid].first > x) {
        r = mid - 1;
      } else {
        ans = v[mid].second;
        break;
      }
    }
    cnt1 += (ans + 1);
    cnt2 += n - ans;
  }
  cout << cnt1 << " " << cnt2 << endl;
}
int main() {
  BEGIN();
  solve();
}
