#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
template <typename T>
void chkmin(T &x, T y) {
  if (y < x) x = y;
}
template <typename T>
void chkmax(T &x, T y) {
  if (y > x) x = y;
}
template <typename T>
void upd(T &x, T y) {
  if ((x += y) >= mod) x -= mod;
}
int n, m, K, N, sl, fh, ans, a[1000010], s[1000010], l[1000010], r[1000010],
    num[1000010];
int p[256], f[256], g[256], trs[256];
set<int> ex;
vector<int> add[1000010], del[1000010], pos[1000010];
int rd() {
  sl = 0;
  fh = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') sl = sl * 10 + ch - '0', ch = getchar();
  return sl * fh;
}
int main() {
  n = rd();
  m = rd();
  K = rd();
  for (int i = 1; i <= n; ++i) s[++N] = l[i] = rd() - 1, s[++N] = r[i] = rd();
  sort(s + 1, s + N + 1);
  N = unique(s + 1, s + N + 1) - s - 1;
  for (int i = 1; i <= n; ++i) {
    l[i] = lower_bound(s + 1, s + N + 1, l[i]) - s;
    r[i] = lower_bound(s + 1, s + N + 1, r[i]) - s;
    add[l[i]].push_back(i);
    del[r[i]].push_back(i);
  }
  for (int i = 1; i <= N; ++i) {
    for (auto v : ex) pos[i].push_back(v);
    for (auto v : add[i]) ex.insert(v);
    for (auto v : del[i]) ex.erase(v);
    pos[i].resize(K);
  }
  for (int i = 1; i < 1 << K; ++i) num[i] = num[i ^ (i & -i)] + 1;
  int T, S = 0;
  pos[N + 1].resize(K);
  for (int k = 1; k <= N; ++k) {
    T = 0;
    for (int i = 0; i < K; ++i)
      if (pos[k][i]) T |= 1 << i;
    for (int x = 0; x < 1 << K; ++x)
      f[x] = (num[x & T] & 1) * (s[k] - s[k - 1]) + g[x & S];
    memset(p, 0, sizeof(p));
    for (int i = 0; i < K; ++i)
      if (pos[k][i])
        for (int j = 0; j < K; ++j)
          if (pos[k][i] == pos[k + 1][j]) {
            p[1 << i] = 1 << j;
            break;
          }
    memset(g, 0, sizeof(g));
    g[0] = f[0];
    S = 0;
    for (int x = 1; x < 1 << K; ++x) {
      trs[x] = trs[x ^ (x & -x)] | p[x & -x];
      chkmax(g[trs[x]], f[x]);
    }
    for (int i = 0; i < K; ++i)
      if (p[1 << i]) S |= p[1 << i];
  }
  for (int i = 0; i < 1 << K; ++i) chkmax(ans, f[i]);
  printf("%d\n", ans);
  return 0;
}
