#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool mmax(T &m, const T q) {
  if (m < q) {
    m = q;
    return true;
  } else
    return false;
}
template <typename T>
bool mmin(T &m, const T q) {
  if (q < m) {
    m = q;
    return true;
  } else
    return false;
}
constexpr int INF = 1.1e9;
int main() {
  int N, M, K;
  cin >> N >> M >> K;
  vector<pair<int, int>> lr(N);
  for (auto &p : lr) cin >> p.first >> p.second;
  set<int> z;
  for (auto p : lr) z.insert(p.first), z.insert(p.second + 1);
  map<int, vector<int>> l2r;
  for (auto p : lr) l2r[p.first].push_back(p.second + 1);
  vector<int> dp(1 << K, -1.1e9);
  dp[0] = 0;
  vector<int> R(K, 0);
  int exist = 0;
  int xp = 0;
  for (auto x : z) {
    for (int S = 0; S < (1 << K); ++S)
      if (!((~exist) & S) and (__builtin_popcount(S) & 1)) dp[S] += x - xp;
    for (int d = 0; d < K; ++d)
      if (R[d] == x) {
        R[d] = 0;
        exist -= 1 << d;
        for (int S = 0; S < (1 << K); ++S)
          if ((S >> d) & 1) {
            mmax(dp[S - (1 << d)], dp[S]);
            dp[S] = -INF;
          }
      }
    for (auto nxtr : l2r[x]) {
      int d = 0;
      while (R[d]) d++;
      R[d] = nxtr;
      exist += 1 << d;
      for (int S = 0; S < (1 << K); ++S)
        if ((S >> d) & 1) mmax(dp[S], dp[S - (1 << d)]);
    }
    xp = x;
  }
  cout << *max_element(dp.begin(), dp.end()) << endl;
}
