#include <bits/stdc++.h>
using namespace std;
long long nowdp[256];
long long newdp[256];
vector<pair<long long, long long>> p;
long long pos[8];
long long pc;
signed main() {
  long long N, M, K;
  cin >> N >> M >> K;
  long long i, n;
  for (i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    p.push_back({a, i + N});
    p.push_back({b + 1, i});
  }
  sort(p.begin(), p.end());
  memset(nowdp, -11, sizeof(nowdp));
  memset(newdp, -11, sizeof(newdp));
  nowdp[0] = 0;
  for (i = 0; i < 2 * N; i++) {
    memset(newdp, -11, sizeof(newdp));
    if (p[i].second >= N) {
      pc++;
      pos[pc - 1] = p[i].second - N;
      for (n = 0; n < (1 << (pc - 1)); n++) {
        long long j;
        long long c = 0;
        for (j = 0; j < pc - 1; j++) c += (n & (1 << j)) / (1 << j);
        newdp[n] = nowdp[n] + c % 2 * (p[i + 1].first - p[i].first);
        newdp[n + (1 << (pc - 1))] =
            nowdp[n] + (c + 1) % 2 * (p[i + 1].first - p[i].first);
      }
    } else {
      pc--;
      long long po = 0;
      for (n = 0; n <= pc; n++) {
        if (pos[n] == p[i].second) po = n;
      }
      for (n = 0; n < (1 << (pc + 1)); n++) {
        long long newno = n % (1 << po) + n / (1 << (po + 1)) * (1 << po);
        long long j;
        long long c = 0;
        for (j = 0; j < pc; j++) c += (newno & (1 << j)) / (1 << j);
        newdp[newno] = max(
            newdp[newno],
            nowdp[n] +
                c % 2 * ((i + 1 == 2 * N) ? 0 : (p[i + 1].first - p[i].first)));
      }
      for (n = po + 1; n <= pc; n++) {
        pos[n - 1] = pos[n];
      }
    }
    for (n = 0; n < (1 << pc); n++) {
      nowdp[n] = newdp[n];
    }
  }
  cout << nowdp[0];
}
