#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int f[256], b[8];
vector<pair<int, int>> a;
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    a.push_back({l, i});
    a.push_back({r + 1, -i});
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < 2 * n; i++) {
    if (i > 0) {
      int ms = 0;
      for (int p = 0; p < 8; p++) {
        if (b[p]) ms += 1 << p;
      }
      for (int s = 0; s < (1 << k); s++) {
        int cnt = __builtin_popcount(s & ms);
        if (cnt & 1) f[s] += a[i].first - a[i - 1].first;
      }
    }
    int j = i;
    while (j < 2 * n && a[j].first == a[i].first) {
      int y = a[j].second;
      if (y < 0) {
        y = -y;
        for (int p = 0; p < 8; p++) {
          if (b[p] == y) {
            for (int s = 0; s < (1 << k); s++)
              f[s] = max(f[s], f[s ^ (1 << p)]);
            b[p] = 0;
            break;
          }
        }
      } else {
        for (int p = 0; p < 8; p++) {
          if (b[p] == 0) {
            b[p] = y;
            break;
          }
        }
      }
      j++;
    }
    i = j - 1;
  }
  int ans = 0;
  for (int i = 0; i < (1 << k); i++) ans = max(ans, f[i]);
  printf("%d\n", ans);
  return 0;
}
