#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  vector<long long> dp(k + 1, 0LL);
  for (long long i = 1; i <= k; i++) {
    cin >> dp[i];
  }
  long long q = n * m;
  long long ans = 0;
  for (long long i = 1; i <= q; i++) {
    long long a;
    cin >> a;
    long long index = 1LL;
    while (dp[index] != a) {
      index++;
    }
    ans = ans + index;
    swap(dp[index], dp[0LL]);
    for (long long i = index; i >= 1; i--) {
      dp[i] = dp[i - 1];
    }
  }
  cout << ans;
}
