#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
template <class T>
using vec = std::vector<T>;
bool __hack = std::ios::sync_with_stdio(false);
auto __hack1 = cin.tie(nullptr);
template <class T>
inline T set_bit(T mask, int bit) {
  assert(0 <= bit && bit < numeric_limits<T>::digits);
  return mask | ((T)(1) << bit);
}
template <class T>
inline T unset_bit(T mask, int bit) {
  assert(0 <= bit && bit < numeric_limits<T>::digits);
  return mask & ~((T)(1) << bit);
}
template <class T>
inline bool get_bit(T mask, int bit) {
  assert(0 <= bit && bit < numeric_limits<T>::digits);
  return mask & ((T)(1) << bit);
}
namespace template_util {
constexpr int bytecount(uint64_t x) { return x ? 1 + bytecount(x >> 8) : 0; }
template <int N>
struct bytetype {};
template <uint64_t N>
struct minimal_uint : bytetype<bytecount(N)> {};
}  // namespace template_util
int ni(istream& in) {
  int ret;
  in >> ret;
  return ret;
}
void solve(istream& in, ostream& out) {
  auto n = ni(in);
  auto m = ni(in);
  auto k = ni(in);
  vec<pair<int, int>> events;
  for (int i = 0; i < (n); ++i) {
    auto l = ni(in);
    auto r = ni(in);
    events.push_back({l, i + 1});
    events.push_back({r + 1, -(i + 1)});
  }
  sort(events.begin(), events.end());
  vec<int> dp(1 << k, -1);
  vec<int> nxt(1 << k, -1);
  dp[0] = 0;
  int prevX = events[0].first;
  vec<int> bitMap(n, -1);
  set<int> bits;
  for (auto& e : events) {
    int id = abs(e.second) - 1;
    int len = e.first - prevX;
    if (e.second > 0) {
      int needB = -1;
      for (int b = 0; b < (k); ++b) {
        if (bits.find(b) == bits.end()) {
          needB = b;
          break;
        }
      }
      bits.insert(needB);
      bitMap[id] = needB;
      for (int mask = 0; mask < (1 << k); ++mask) {
        if (dp[mask] == -1) {
          continue;
        }
        int nmask = set_bit(mask, bitMap[id]);
        if (__builtin_popcount(mask) & 1) {
          nxt[mask] = max(nxt[mask], dp[mask] + len);
          nxt[nmask] = max(nxt[nmask], dp[mask] + len);
        } else {
          nxt[mask] = max(nxt[mask], dp[mask]);
          nxt[nmask] = max(nxt[nmask], dp[mask]);
        }
      }
    } else {
      bits.erase(bitMap[id]);
      for (int mask = 0; mask < (1 << k); ++mask) {
        if (dp[mask] == -1) {
          continue;
        }
        if (!get_bit(mask, bitMap[id])) {
          if (__builtin_popcount(mask) & 1) {
            nxt[mask] = max(nxt[mask], dp[mask] + len);
          } else {
            nxt[mask] = max(nxt[mask], dp[mask]);
          }
        } else {
          int nmask = unset_bit(mask, bitMap[id]);
          if (__builtin_popcount(mask) & 1) {
            nxt[nmask] = max(nxt[nmask], dp[mask] + len);
          } else {
            nxt[nmask] = max(nxt[nmask], dp[mask]);
          }
        }
      }
    }
    prevX = e.first;
    dp = nxt;
    nxt = vec<int>(1 << k, -1);
  }
  out << dp[0] << "\n";
}
int main() {
  solve(cin, cout);
  return 0;
}
