#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 50;
int n, m, k, a[MAXN];
struct Node {
  int l, r;
} z[MAXN];
void readInput() {
  int t;
  scanf("%d%d%d", &m, &t, &k);
  vector<int> v;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &z[i].l, &z[i].r);
    z[i].r++;
    v.push_back(z[i].l);
    v.push_back(z[i].r);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  for (int i = 1; i <= m; i++) {
    z[i].l = lower_bound(v.begin(), v.end(), z[i].l) - v.begin() + 1;
    z[i].r = lower_bound(v.begin(), v.end(), z[i].r) - v.begin() + 1;
  }
  n = (int)v.size();
  for (int i = 1; i < n; i++) a[i] = v[i] - v[i - 1];
}
const int MAXK = 8;
long long dp[2][(1 << MAXK)], c[(1 << MAXK)], p[(1 << MAXK)], cnt1[(1 << MAXK)];
vector<int> rlist[MAXN];
void solve() {
  for (int bm = 0; bm < (1 << MAXK); bm++) {
    for (int x = 0; x < MAXK; x++)
      if (bm & (1 << x)) cnt1[bm]++;
  }
  for (int i = 1; i <= m; i++) {
    for (int j = z[i].l; j < z[i].r; j++) rlist[j].push_back(i);
  }
  for (int x = 1; x <= n; x++) {
    memset(c, 0, sizeof c);
    memset(p, 0, sizeof p);
    int t = (int)rlist[x].size(), s = (int)rlist[x - 1].size();
    int prev = 0, cur = 0;
    vector<int> bmlist;
    bmlist.push_back(0);
    for (int i = 0; i < t; i++) {
      for (int j = 0; j < s; j++) {
        if (rlist[x][i] == rlist[x - 1][j]) {
          prev |= (1 << j);
          cur |= (1 << i);
          vector<int> tmp;
          for (int bm : bmlist) {
            p[bm | (1 << i)] = p[bm] | (1 << j);
            tmp.push_back(bm | (1 << i));
          }
          for (int bm : tmp) bmlist.push_back(bm);
        }
      }
    }
    for (int bm = 0; bm < (1 << s); bm++)
      c[bm & prev] = max(c[bm & prev], dp[(x - 1) & 1][bm]);
    for (int bm = 0; bm < (1 << t); bm++)
      dp[x & 1][bm] = c[p[bm & cur]] + ((cnt1[bm] & 1) ? a[x] : 0);
  }
  printf("%lld\n", dp[n & 1][0]);
}
int main() {
  readInput();
  solve();
}
