#include <bits/stdc++.h>
using namespace std;
long long anw, n, m, k, dp[554], l[100005], r[100005], ck[15];
vector<pair<long long, long long> > ar;
long long get(long long a) {
  long long ret = 0;
  for (int i = k - 1; i >= 0; i--)
    if (a & (1 << i)) a -= (1 << i), ret++;
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    ar.push_back({l[i], i}), ar.push_back({r[i] + 1, -i});
  }
  sort(ar.begin(), ar.end());
  for (int i = 0; i < (1 << k); i++) dp[i] = -1e9;
  dp[0] = 0;
  long long st = 0;
  for (int i = 0; i < 2 * n; i++) {
    for (int j = 0; j < (1 << k); j++)
      if (get(j) % 2 == 1) dp[j] += ar[i].first - st;
    st = ar[i].first;
    if (ar[i].second < 0) {
      long long nw = -ar[i].second, id = 0;
      for (int i = 0; i < k; i++)
        if (ck[i] == nw) {
          id = i, ck[i] = 0;
          break;
        }
      for (int j = 0; j < (1 << k); j++)
        if (j & (1 << id)) {
          dp[j ^ (1 << id)] = max(dp[j], dp[j ^ (1 << id)]);
          dp[j] = -1e9;
        }
    } else {
      long long nw = ar[i].second, id = 0;
      for (int i = 0; i < k; i++)
        if (ck[i] == 0) {
          ck[i] = nw, id = i;
          break;
        }
      for (int j = 0; j < (1 << k); j++)
        if (!(j & (1 << id))) dp[j | (1 << id)] = dp[j];
    }
  }
  for (int j = 0; j < (1 << k); j++) anw = max(dp[j], anw);
  cout << anw;
  return 0;
}
