#include <bits/stdc++.h>
using namespace std;
int n, m, k, dcnt[300], L[100050], R[100050], had[10];
long long dp[300];
vector<pair<int, int> > v;
int getcnt(int num) {
  int cnt = 0;
  while (num) {
    if (num & 1) cnt++;
    num >>= 1;
  }
  return cnt;
}
void solve() {
  int i, j, kd;
  cin >> n >> m >> k;
  kd = (1 << k);
  for (i = 1; i <= n; i++) {
    cin >> L[i] >> R[i];
    v.emplace_back(pair<int, int>(L[i], i));
    v.emplace_back(pair<int, int>(R[i] + 1, -i));
  }
  sort(v.begin(), v.end());
  for (i = 0; i < kd; i++) {
    dcnt[i] = (getcnt(i) & 1);
    dp[i] = -0x3f3f3f3f;
  }
  dp[0] = 0;
  int lst = 0;
  for (i = 0; i < 2 * n; i++) {
    for (j = 0; j < kd; j++)
      if (dcnt[j] == 1) dp[j] += v[i].first - lst;
    lst = v[i].first;
    if (v[i].second < 0) {
      int curd = 0;
      for (j = 0; j < k; j++)
        if (had[j] == (-v[i].second)) {
          curd = (1 << j);
          had[j] = 0;
          break;
        }
      for (j = 0; j < kd; j++)
        if (j & curd) {
          dp[j ^ curd] = max(dp[j], dp[j ^ curd]);
          dp[j] = -0x3f3f3f3f;
        }
    } else {
      int curd = 0;
      for (j = 0; j < k; j++)
        if (had[j] == 0) {
          curd = (1 << j);
          had[j] = v[i].second;
          break;
        }
      for (j = 0; j < kd; j++)
        if (!(j & curd)) dp[j | curd] = dp[j];
    }
  }
  long long mx = dp[0];
  for (i = 1; i < kd; i++) mx = max(mx, dp[i]);
  cout << mx << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
