#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, t, k, l, m, n, e, p;
  char a;
  string s;
  while (cin >> n >> m >> k) {
    deque<int> mydeque;
    int ara[k + 1], rem[k + 1];
    for (i = 1; i <= k; i++) {
      cin >> p;
      mydeque.push_back(p);
    }
    int sum = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        cin >> t;
        l = 1;
        p = 0;
        for (deque<int>::iterator it = mydeque.begin(); it != mydeque.end();
             l++, ++it) {
          if (*it == t) break;
        }
        if (l > k) l--;
        sum += l;
        mydeque.erase(mydeque.begin() + l - 1);
        mydeque.push_front(t);
      }
    }
    cout << sum << endl;
  }
  return 0;
}
