#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using ll = long long;
int n, m, k;
vector<int> l, r;
vector<ii> sorted;
vector<int> layer;
vector<vector<int>> dp;
bool cmp(const ii &a, const ii &b) {
  int valA = a.second ? r[a.first] : l[a.first];
  int valB = b.second ? r[b.first] : l[b.first];
  if (valA == valB) return a.second < b.second;
  return valA < valB;
}
int f(int i, int mask) {
  if (i == 2 * n) return 0;
  if (dp[i][mask] != -1) return dp[i][mask];
  int isRight = sorted[i].second, index = sorted[i].first, pos;
  int curLayer = layer[index];
  int sum = 0, val = 0;
  if (isRight) {
    pos = r[index];
    int newMask = mask & ~(1 << curLayer);
    val = f(i + 1, newMask);
  } else {
    pos = l[index];
    int newMask = mask | (1 << curLayer);
    val = max(f(i + 1, mask), f(i + 1, newMask));
  }
  if (__builtin_popcount(mask) & 1) {
    int prevIsRight = sorted[i - 1].second, prevIndex = sorted[i - 1].first,
        prevPos;
    if (prevIsRight)
      prevPos = r[prevIndex];
    else
      prevPos = l[prevIndex];
    sum += pos - prevPos + isRight - prevIsRight;
  }
  return dp[i][mask] = sum + val;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k;
  dp.resize(n << 1, vector<int>(1 << k, -1));
  l.resize(n);
  r.resize(n);
  layer.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> l[i] >> r[i];
    sorted.push_back(ii(i, 0));
    sorted.push_back(ii(i, 1));
  }
  sort(sorted.begin(), sorted.end(), cmp);
  set<int> free = {0, 1, 2, 3, 4, 5, 6, 7};
  for (int i = 0; i < 2 * n; ++i) {
    int isRight = sorted[i].second, index = sorted[i].first;
    if (isRight) {
      int getLayer = layer[index];
      free.insert(getLayer);
    } else {
      int getLayer = *free.begin();
      free.erase(getLayer);
      layer[index] = getLayer;
    }
  }
  cout << f(0, 0) << "\n";
  return 0;
}
