#include <bits/stdc++.h>
using namespace std;
int n, m, k;
const int N = (int)1e5;
const int K = 8;
pair<int, int> a[N];
struct Event {
  int time;
  bool type;
  int id;
  Event() {}
  Event(int time, bool type, int id) : time(time), type(type), id(id) {}
  bool operator<(const Event& other) const {
    if (time != other.time) return time < other.time;
    return type < other.type;
  }
};
vector<Event> v;
int wh[N];
bool is_free[K];
int dp[2 * N][1 << K];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    a[i].first--;
  }
  for (int i = 0; i < n; i++) {
    v.emplace_back(a[i].first, true, i);
    v.emplace_back(a[i].second, false, i);
  }
  sort(v.begin(), v.end());
  fill(is_free, is_free + k, true);
  for (int i = 0; i < 2 * n; i++) {
    int j = v[i].id;
    if (v[i].type) {
      int p = 0;
      while (!is_free[p]) p++;
      is_free[p] = false;
      wh[j] = p;
      int msk = 0;
      for (int p = 0; p < k; p++) msk |= (!is_free[p]) << p;
      for (int m = msk;; m = (m - 1) & msk) {
        int pm = m & (~(1 << p));
        if (i == 0 || dp[i - 1][pm] >= 0)
          dp[i][m] = (i > 0 ? dp[i - 1][pm] : 0) +
                     (__builtin_popcount(pm) & 1) *
                         (v[i].time - (i > 0 ? v[i - 1].time : v[i].time));
        if (m == 0) break;
      }
    } else {
      int p = wh[j];
      is_free[p] = true;
      int msk = 0;
      for (int p = 0; p < k; p++) msk |= (!is_free[p]) << p;
      for (int m = msk;; m = (m - 1) & msk) {
        int pm1 = m;
        int pm2 = m | (1 << p);
        int t = v[i].time - v[i - 1].time;
        dp[i][m] = max(dp[i - 1][pm1] + t * (__builtin_popcount(pm1) & 1),
                       dp[i - 1][pm2] + t * (__builtin_popcount(pm2) & 1));
        if (m == 0) break;
      }
    }
  }
  cout << *max_element(dp[2 * n - 1], dp[2 * n - 1] + (1 << k)) << "\n";
  return 0;
}
