#include <bits/stdc++.h>
using namespace std;
int INF = 1e9;
long long MAX = 1e18;
long double eps = numeric_limits<long double>::epsilon();
long double PI = acos(-1);
int const N = 2e5 + 16;
int const M = 1e9 + 7;
int const M2 = 999999983;
template <class t>
void sc(t& x) {
  int c, z = 0;
  while (!isdigit(c = getchar())) z = c;
  x = (c - '0');
  while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c - '0');
  if (z == '-') x = -x;
}
template <class t>
void print(t x) {
  static char buf[32] = {};
  int i = 32;
  if (x == 0) {
    puts("0");
    return;
  } else if (x < 0)
    putchar('-'), x = -x;
  while (x) {
    t y = x / 10;
    buf[--i] = x - (y << 1) - (y << 3) + '0';
    x = y;
  }
  puts(buf + i);
}
int n, m, k;
int a[128];
int b[128];
int pos[128];
int g[128][128];
int fetch(int x) {
  int idx;
  for (int i = 0; i < k; ++i)
    if (a[i] == x) {
      idx = i;
      break;
    }
  b[0] = a[idx];
  int z = 1;
  for (int i = 0; i < k; ++i)
    if (i == idx)
      continue;
    else
      b[z++] = a[i];
  for (int i = 0; i < k; ++i) a[i] = b[i];
  return idx;
}
int main() {
  sc(n), sc(m), sc(k);
  for (int i = 0; i < k; ++i) sc(a[i]), pos[--a[i]] = i;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) sc(g[i][j]), --g[i][j];
  int cost = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int x = g[i][j];
      int v = fetch(x);
      cost += v + 1;
    }
  }
  print(cost);
}
