#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int n, m, t;
struct node {
  int flag, place, id, len;
} re[N * 2];
inline bool cmp(node x, node y) {
  if (x.place == y.place) return x.flag < y.flag;
  return x.place < y.place;
}
int stk[N], top = 0;
int f[(1 << 8) + 5], tmp[(1 << 8) + 5], ones[(1 << 8) + 5];
int mp[(1 << 8) + 5][15];
inline void prework() {
  for (int i = 0; i < (1 << 8); i++)
    for (int j = 0; j < 8; j++) {
      int now = 0;
      for (int k = 0; k < 8; k++)
        if (j != k) mp[i][j] += (1 << now) * ((i >> k) & 1), now++;
    }
  for (int i = 1; i < (1 << 8); i++) ones[i] = ones[i - (i & (-i))] + 1;
}
int main() {
  prework();
  n = read();
  m = read();
  t = read();
  for (int i = 1; i <= n; i++) {
    re[i].place = read();
    re[i + n].place = read() + 1;
    re[i].flag = 1;
    re[i + n].flag = -1;
    re[i].id = re[i + n].id = i;
  }
  sort(re + 1, re + n * 2 + 1, cmp);
  for (int i = 1; i < n * 2; i++) re[i].len = re[i + 1].place - re[i].place;
  memset(f, -0x3f3f3f3f, sizeof(f));
  f[0] = 0;
  for (int i = 1; i <= 2 * n; i++) {
    memset(tmp, -0x3f3f3f3f, sizeof(tmp));
    if (re[i].flag == 1) {
      for (int j = 0; j < (1 << top); j++) {
        tmp[j + (1 << top)] =
            max(tmp[j + (1 << top)], f[j] + (1 - ones[j] % 2) * re[i].len);
        tmp[j] = max(tmp[j], f[j] + ones[j] % 2 * re[i].len);
      }
      stk[++top] = re[i].id;
    } else {
      int k = 0;
      for (int j = 1; j <= top; j++)
        if (stk[j] == re[i].id) {
          k = j - 1;
          break;
        }
      for (int j = 0; j < (1 << top); j++) {
        if ((j >> k) & 1)
          tmp[mp[j][k]] =
              max(tmp[mp[j][k]], f[j] + (1 - ones[j] % 2) * re[i].len);
        else
          tmp[mp[j][k]] = max(tmp[mp[j][k]], f[j] + ones[j] % 2 * re[i].len);
      }
      top--;
      for (int j = k + 1; j <= top; j++) stk[j] = stk[j + 1];
    }
    memcpy(f, tmp, sizeof(tmp));
  }
  printf("%d\n", f[0]);
  return 0;
}
