#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 1e5, K = 8;
int n, m, k;
int l[N + 7], r[N + 7];
struct point {
  int op, w, d;
  point(int OP = 0, int W = 0, int D = 0) { op = OP, w = W, d = D; }
};
int cmp(point x, point y) {
  if (x.w == y.w) return x.op < y.op;
  return x.w < y.w;
}
int pcnt;
point p[(N << 1) + 7];
int d[K + 7], one[(1 << K) + 7];
int f[(N << 1) + 7][(1 << K) + 7];
void Max(int& x, int y) { x = max(x, y); }
int DP() {
  int ful = (1 << k) - 1;
  for (int i = 1; i <= ful; i++) one[i] = one[i - (i & -i)] + 1;
  for (int i = 0; i <= pcnt; i++)
    for (int j = 0; j <= ful; j++) f[i][j] = -inf;
  f[0][0] = 0;
  for (int j = 1; j <= k; j++) d[j] = -1;
  int now = 0;
  for (int i = 1; i <= pcnt; i++) {
    int at = -1;
    if (p[i].op == 1) {
      for (int j = 1; j <= k; j++)
        if (d[j] == -1) {
          at = j, d[j] = p[i].d;
          break;
        }
      assert(~at);
      for (int j = 0; j <= now; j++)
        if ((j & now) == j) {
          Max(f[i][j], f[i - 1][j] + (one[j] & 1) * (p[i].w - p[i - 1].w));
          Max(f[i][j | (1 << (at - 1))],
              f[i - 1][j] + (one[j] & 1) * (p[i].w - 1 - p[i - 1].w) +
                  ((one[j] + 1) & 1));
        }
      now |= (1 << (at - 1));
    } else {
      for (int j = 1; j <= k; j++)
        if (d[j] == p[i].d) {
          at = j, d[j] = -1;
          break;
        }
      assert(~at);
      now ^= (1 << (at - 1));
      for (int j = 0; j <= now; j++)
        if ((j & now) == j) {
          Max(f[i][j], f[i - 1][j] + (one[j] & 1) * (p[i].w - p[i - 1].w));
          Max(f[i][j], f[i - 1][j | (1 << (at - 1))] +
                           ((one[j] + 1) & 1) * (p[i].w - 1 - p[i - 1].w) +
                           (one[j] & 1));
        }
    }
  }
  return f[pcnt][0];
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    p[++pcnt] = point(1, l[i], i);
    p[++pcnt] = point(-1, r[i] + 1, i);
  }
  sort(p + 1, p + pcnt + 1, cmp);
  printf("%d\n", DP());
  return 0;
}
