#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int N = 1e5 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7;
int n, k, m;
int main() {
  ios_base::sync_with_stdio(0);
  while (cin >> n >> k >> m) {
    vector<int> v;
    for (int i = 1; i <= m; ++i) {
      int x;
      cin >> x;
      v.push_back(x);
    }
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= k; ++j) {
        int x;
        cin >> x;
        auto iter = find(v.begin(), v.end(), x);
        ans += iter - v.begin() + 1;
        v.erase(iter);
        v.insert(v.begin(), x);
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
