#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 9, M = 110000, inf = 1e9;
int n, m, k, f[N], pc[N], ind[M];
set<int> unu;
vector<pair<int, int> > app;
template <class T>
inline void read(T &x) {
  x = 0;
  char ch = getchar(), w = 0;
  while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  x = w ? -x : x;
  return;
}
int main() {
  int x, y;
  read(n), read(m), read(k);
  for (register int i = 1; i <= n; ++i) {
    read(x), read(y);
    app.push_back(make_pair(x, i));
    app.push_back(make_pair(y + 1, -i));
  }
  sort(app.begin(), app.end());
  int lst = 0;
  for (register int i = 0; i < k; ++i) unu.insert(i);
  for (register int i = 1; i < 1 << k; ++i)
    f[i] = -inf, pc[i] = pc[i >> 1] ^ (i & 1);
  for (auto &v : app) {
    for (register int i = 0; i < 1 << k; ++i)
      if (pc[i]) f[i] += v.first - lst;
    lst = v.first;
    if (v.second > 0) {
      assert(!unu.empty());
      ind[v.second] = *unu.begin();
      unu.erase(unu.begin());
      for (register int i = 0; i < 1 << k; ++i)
        if (i & (1 << ind[v.second]))
          f[i] = max(f[i ^ (1 << ind[v.second])], f[i]);
    } else {
      v.second *= -1;
      unu.insert(ind[v.second]);
      for (register int i = 0; i < 1 << k; ++i)
        if (i & (1 << ind[v.second])) {
          f[i ^ (1 << ind[v.second])] = max(f[i ^ (1 << ind[v.second])], f[i]);
          f[i] = -inf;
        }
    }
  }
  cout << f[0] << endl;
  return 0;
}
