#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const double PI = 2 * asin(1);
int g_n, g_m, g_k;
int bd[2][110];
void pretreat() {}
void input() {
  for (int i = 1; i <= g_k; ++i) {
    scanf(" %d", &bd[0][i]);
  }
}
void solve() {
  int ans = 0, s = 0, p;
  for (int i = 0; i < g_n; ++i) {
    for (int j = 0; j < g_m; ++j) {
      scanf(" %d", &p);
      for (int k = 1; k <= g_k; ++k) {
        if (bd[s][k] == p) {
          ans += k;
        }
      }
      s = 1 - s;
      int num = 1;
      bd[s][num++] = p;
      for (int k = 1; k <= g_k; ++k) {
        if (bd[1 - s][k] != p) {
          bd[s][num++] = bd[1 - s][k];
        }
      }
    }
  }
  cout << ans << endl;
}
int main() {
  pretreat();
  while (cin >> g_n >> g_m >> g_k) {
    input();
    solve();
  }
  return 0;
}
