#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 50;
int n, tot;
int dp[300], bt[8], cnt[255];
pair<int, int> pa[N];
int main() {
  scanf("%d%*d%*d", &n);
  for (int i = 1, l, r; i <= n; ++i) {
    scanf("%d%d", &l, &r);
    pa[++tot] = {l, i};
    pa[++tot] = {r + 1, -i};
  }
  sort(pa + 1, pa + 1 + tot);
  for (int i = 1; i <= 255; ++i) cnt[i] = cnt[i >> 1] + (i & 1);
  for (int i = 1; i <= tot; ++i) {
    int id = pa[i].second, w;
    int len = (i == tot ? 0 : pa[i + 1].first - pa[i].first);
    if (id > 0) {
      for (int t = 0; t < 8; ++t) {
        if (!bt[t]) {
          bt[w = t] = id;
          break;
        }
      }
      for (int t = 255; t >= 0; --t) {
        if (t & (1 << w)) {
          dp[t] = dp[t ^ (1 << w)] + (cnt[t] & 1) * len;
        } else {
          dp[t] += (cnt[t] & 1) * len;
        }
      }
    } else {
      for (int t = 0; t < 8; ++t) {
        if (bt[t] == -id) {
          bt[w = t] = 0;
          break;
        }
      }
      for (int t = 0; t <= 255; ++t) {
        if (t & (1 << w)) {
          dp[t] = -1e9;
        } else {
          dp[t] = max(dp[t], dp[t | (1 << w)]) + (cnt[t] & 1) * len;
        }
      }
    }
  }
  printf("%d", dp[0]);
  return 0;
}
