#include <bits/stdc++.h>
using namespace std;
const int nsz = 1e5, ksz = 8, msksz = (1 << ksz) - 1, inf = 0x3f3f3f3f;
bool vis[nsz + 5];
int n, m, k, full, p[nsz + 5], q[ksz + 5], dp[2][msksz + 5], ans;
vector<pair<int, int> > s;
struct event {
  int pos, id, st;
  event(int pos = 0, int id = 0, int st = 0) {
    this->pos = pos, this->id = id, this->st = st;
  }
};
vector<event> dat;
bool inline operator<(event a, event b) {
  return a.pos != b.pos ? a.pos < b.pos : a.st < b.st;
}
void inline upd(int &a, int b) { a < b && (a = b); }
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    s.push_back(make_pair(l, r));
  }
  sort(s.begin(), s.end());
  s.erase(unique(s.begin(), s.end()), s.end());
  for (int i = 0; i < s.size(); ++i) {
    int l = s[i].first, r = s[i].second;
    dat.push_back(event(l, i, +1));
    dat.push_back(event(r + 1, i, -1));
  }
  sort(dat.begin(), dat.end());
  memset(dp, -inf, sizeof(dp));
  int o = 0, x = 1, l = dat[0].pos, i = 0, k = 0;
  for (; i < dat.size() && dat[i].pos == l; ++i) {
    p[dat[i].id] = k;
    q[k] = dat[i].id;
    ++k;
  }
  full = (1 << k) - 1;
  for (int S = 0; S <= full; ++S) {
    dp[o][S] = 0;
  }
  for (; i < dat.size();) {
    l = dat[i].pos;
    int il = i, ir = i, len = dat[i].pos - dat[i - 1].pos, pk = k, dk = 0,
        pfull = full, dfull;
    memset(vis, 0, sizeof(vis));
    for (; i < dat.size() && dat[i].pos == l; ++i, ++ir) {
      if (dat[i].st == -1) {
        vis[p[dat[i].id]] = 1;
        --k;
      }
    }
    for (int i = 0, j = 0; i < pk; ++i) {
      if (vis[i]) continue;
      p[q[i]] = j, q[j] = q[i];
      ++j;
    }
    for (int i = il; i <= ir - 1; ++i) {
      if (dat[i].st == +1) {
        p[dat[i].id] = k, q[k] = dat[i].id;
        ++k;
        ++dk;
      }
    }
    full = (1 << k) - 1;
    dfull = (1 << dk) - 1;
    for (int S = 0; S <= pfull; ++S) {
      int val = dp[o][S] + (__builtin_popcount(S) & 1) * len, nS = 0, j = 0;
      if (val < 0) continue;
      for (int i = 0; i < pk; ++i) {
        if (vis[i]) continue;
        nS |= (S >> i & 1) << j;
        ++j;
      }
      if (dk <= 0) {
        upd(dp[x][nS], val);
      } else {
        for (int dS = 0; dS <= dfull; ++dS) {
          int nnS = nS | (dS << (k - dk));
          upd(dp[x][nnS], val);
        }
      }
    }
    swap(o, x);
    memset(dp[x], -inf, sizeof(dp[x]));
  }
  for (int S = 0; S <= full; ++S) {
    upd(ans, dp[o][S]);
  }
  printf("%d\n", ans);
}
