#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000000")
#pragma GCC optimize("O3")
using namespace std;
const int MOD = 1000000007;
const int INF = 1000000007LL;
const long long INF2 = 1000000007LL * 1000000007LL;
const long double EPS = 1e-9;
const int SIZE = 200010;
mt19937 rng(time(0));
uniform_int_distribution<int> uid(-1000000000, 1000000000);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k, ans = 0, x;
  cin >> n >> m >> k;
  vector<int> v(k);
  for (auto& i : v) cin >> i;
  for (int rep_iter = 0; rep_iter < n * m; ++rep_iter) {
    cin >> x;
    int pos = find(begin(v), end(v), x) - v.begin();
    ans += pos + 1;
    v.erase(v.begin() + pos);
    v.insert(v.begin(), x);
  }
  cout << ans;
  return 0;
}
