#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U>
ostream& operator<<(ostream& o, const pair<T, U>& p) {
  o << "(" << p.first << "," << p.second << ")";
  return o;
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& v) {
  o << "[";
  for (T t : v) {
    o << t << ",";
  }
  o << "]";
  return o;
}
using pi = pair<int, int>;
const int INF = 19191919;
int main() {
  int n, m, k;
  scanf(" %d %d %d", &n, &m, &k);
  map<int, vector<int>> IN, OUT;
  vector<int> ux;
  for (int i = 0; i < (int)(n); ++i) {
    int l, r;
    scanf(" %d %d", &l, &r);
    ++r;
    IN[l].push_back(i);
    OUT[r].push_back(i);
    ux.push_back(l);
    ux.push_back(r);
  }
  sort((ux).begin(), (ux).end());
  ux.erase(unique((ux).begin(), (ux).end()), ux.end());
  const int X = ux.size();
  vector<int> dp(1 << k, -INF);
  dp[0] = 0;
  set<int> pre;
  for (int i = 0; i < (int)(X - 1); ++i) {
    vector<int> nx(1 << k, -INF);
    set<int> now(pre);
    for (int j : IN[ux[i]]) now.insert(j);
    for (int j : OUT[ux[i]]) now.erase(j);
    const int sz = now.size();
    vector<int> p((pre).begin(), (pre).end()), q((now).begin(), (now).end());
    const int P = p.size(), Q = q.size();
    int cp_mask = 0, cq_mask = 0;
    map<int, int> q2p;
    for (int ii = 0; ii < (int)(P); ++ii)
      for (int jj = 0; jj < (int)(Q); ++jj)
        if (p[ii] == q[jj]) {
          q2p[jj] = ii;
          cp_mask |= 1 << ii;
          cq_mask |= 1 << jj;
        }
    vector<int> mxcp(1 << k, -INF);
    for (int mask = 0; mask < (int)(1 << P); ++mask) {
      int t = mask & cp_mask;
      mxcp[t] = max(mxcp[t], dp[mask]);
    }
    for (int mask = 0; mask < (int)(1 << sz); ++mask) {
      int cq = mask & cq_mask;
      int cp = 0;
      for (int j = 0; j < (int)(sz); ++j)
        if (mask >> j & 1) {
          if (q2p.count(j)) cp |= 1 << q2p[j];
        }
      int add = 0;
      if (__builtin_popcount(mask) % 2 == 1) add = ux[i + 1] - ux[i];
      nx[mask] = mxcp[cp] + add;
    }
    pre = now;
    dp = nx;
  }
  int ans = -INF;
  for (int i : dp) ans = max(ans, i);
  printf("%d\n", ans);
  return 0;
}
