#include <bits/stdc++.h>
using namespace std;
int bit[1 << 9];
set<int> s;
pair<int, int> a[200007];
int pre[10];
int dp[1 << 9];
int pos[200007];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) {
    int x, y;
    cin >> x >> y;
    a[2 * i - 1] = {x, i};
    a[2 * i] = {y + 1, -i};
  }
  for (int i = 0; i <= k; ++i) pre[i] = 1 << i;
  for (int i = 1; i < pre[k]; ++i) {
    bit[i] = bit[i >> 1] ^ (i & 1);
    dp[i] = -1e9;
  }
  sort(a + 1, a + 1 + 2 * n);
  int last = 0;
  for (int i = 0; i < k; ++i) s.insert(i);
  for (int i = 1; i <= 2 * n; ++i) {
    int now = a[i].first;
    int temp = a[i].second;
    for (int j = 1; j < pre[k]; ++j) dp[j] += bit[j] * (now - last);
    last = now;
    if (temp > 0) {
      pos[temp] = *s.begin();
      s.erase(pos[temp]);
      for (int j = 0; j < pre[k]; ++j)
        if (j & pre[pos[temp]]) dp[j] = max(dp[j], dp[j ^ pre[pos[temp]]]);
    } else {
      temp = -temp;
      s.insert(pos[temp]);
      for (int j = 0; j < pre[k]; ++j)
        if (j & pre[pos[temp]]) {
          dp[j ^ pre[pos[temp]]] = max(dp[j ^ pre[pos[temp]]], dp[j]);
          dp[j] = -1e9;
        }
    }
  }
  cout << dp[0];
  return 0;
}
