#include <bits/stdc++.h>
const int N = 200000 + 7, S = 1 << 8 | 7;
int n, m, k;
struct str {
  int x, y;
} a[N];
int b[N];
int e[N], l[N], r[N], z[N];
int f[S], g[S];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i)
    scanf("%d%d", &a[i].x, &a[i].y), e[i] = --a[i].x, e[i + n] = a[i].y;
  std::sort(e + 1, e + n * 2 + 1);
  m = std::unique(e + 1, e + n * 2 + 1) - e - 1;
  for (int i = 1; i <= n; ++i)
    a[i].x = std::lower_bound(e + 1, e + m + 1, a[i].x) - e,
    a[i].y = std::lower_bound(e + 1, e + m + 1, a[i].y) - e;
  std::sort(a + 1, a + n + 1,
            [](str a, str b) { return a.x != b.x ? a.x < b.x : a.y < b.y; });
  for (int j = 1; j <= k; ++j)
    for (int i = 1, l = 0; i <= n; ++i)
      if (!b[i] && l <= a[i].x) b[i] = j, l = a[i].y;
  for (int i = 1; i <= n; ++i)
    l[a[i].x] |= 1 << b[i] - 1, r[a[i].y] |= 1 << b[i] - 1;
  for (int i = 1; i <= m; ++i) z[i] = z[i - 1] ^ r[i] ^ l[i];
  for (int i = 1; i <= m; ++i) {
    std::fill(g, g + (1 << k), 0);
    for (int j = (1 << k) - 1, l, u, v; ~j; --j) {
      g[j] = f[j];
      for (int l = r[i] & ~j; l; l ^= ((l) & -(l)))
        g[j] = std::max(g[j], g[j ^ ((l) & -(l))]);
    }
    std::fill(f, f + (1 << k), 0);
    for (int j = 0; j < 1 << k; ++j)
      if ((z[i] & j) == j)
        f[j] = g[j & ~l[i]] + __builtin_parity(j) * (e[i + 1] - e[i]);
  }
  printf("%d", f[0]);
  return 0;
}
