#include <bits/stdc++.h>
using namespace std;
using lli = int64_t;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int T = 1;
  for (int t = 1; t <= T; t++) {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> items;
    map<int, int> pos;
    for (int i = 0; i < k; i++) {
      int in;
      cin >> in;
      items.push_back(in);
      pos[in] = i;
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        int in;
        cin >> in;
        ans += pos[in] + 1;
        int x = pos[in];
        for (int l = x; l > 0; l--) {
          pos[items[l - 1]] = l;
          items[l] = items[l - 1];
        }
        pos[in] = 0;
        items[0] = in;
      }
    }
    cout << ans;
  }
}
