#include <bits/stdc++.h>
using namespace std;
template <class T>
using v2d = vector<vector<T>>;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int maxN = 1e5 + 10;
const int inf = 1e9;
int n, m, k, L[maxN], R[maxN], d[maxN * 2], f[1 << 8], g[1 << 8];
vector<pair<int, int>> vec[maxN * 2];
vector<int> sorted;
void solve() {
  cin >> n >> m >> k;
  for (int i = 1; i <= (int)(n); ++i) {
    cin >> L[i] >> R[i];
    sorted.emplace_back(R[i]);
    sorted.emplace_back(L[i] - 1);
  }
  sort((sorted).begin(), (sorted).end());
  sorted.resize(unique((sorted).begin(), (sorted).end()) - sorted.begin());
  m = (int)sorted.size();
  for (int i = 1; i <= (int)(n); ++i) {
    int lo =
        lower_bound((sorted).begin(), (sorted).end(), L[i]) - sorted.begin();
    int hi = upper_bound((sorted).begin(), (sorted).end(), R[i]) -
             sorted.begin() - 1;
    for (int j = (int)(lo); j <= (int)(hi); ++j) {
      vec[j].emplace_back(i, -1);
    }
  }
  for (int i = 0; i < (int)(m); ++i) {
    int id = 0;
    for (int j = 0; j < (int)(vec[i].size()); ++j) {
      if (sorted[i] == R[vec[i][j].first]) {
        swap(vec[i][id], vec[i][j]);
        id++;
      }
    }
    d[i] = id;
    if (i > 0) {
      for (int j = 0; j < (int)(vec[i].size()); ++j) {
        for (int x = 0; x < (int)(vec[i - 1].size()); ++x) {
          if (vec[i - 1][x].first == vec[i][j].first) {
            vec[i][j].second = x;
            break;
          }
        }
      }
    }
  }
  fill(f, f + (1 << k), -inf);
  f[0] = 0;
  for (int i = 1; i <= (int)(m - 1); ++i) {
    copy(f, f + (1 << k), g);
    int s = (int)vec[i - 1].size();
    for (int j = 0; j < (int)(d[i - 1]); ++j) {
      for (int mask = 0; mask < (int)(1 << s); ++mask) {
        if (~mask >> j & 1) {
          uax(g[mask], g[mask ^ (1 << j)]);
        }
      }
    }
    fill(f, f + (1 << k), -inf);
    int t = (int)vec[i].size();
    for (int mask = 0; mask < (int)(1 << t); ++mask) {
      int prevmask = 0, cnt = 0;
      for (int j = 0; j < (int)(t); ++j) {
        if (mask >> j & 1) {
          cnt++;
          if (vec[i][j].second != -1) {
            prevmask |= 1 << vec[i][j].second;
          }
        }
      }
      uax(f[mask], g[prevmask] + (cnt & 1) * (sorted[i] - sorted[i - 1]));
    }
  }
  cout << *max_element(f, f + (1 << k));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
