#include <bits/stdc++.h>
using namespace std;
inline void Input_Output() {}
const double eps = 0.000001;
const long double pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const long long MOD = 1e18 + 9;
const long long INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;
const int M = 22;
const int pri = 997;
const int Magic = 2101;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int n, m, k;
vector<pair<int, int> > e;
vector<long long> dp, ndp;
bool odd[(1 << 8)];
int ids[8];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  dp.resize(1 << k);
  ndp.resize(1 << k);
  for (int i = 0; i < (1 << k); ++i) {
    odd[i] = (__builtin_popcount(i) & 1);
  }
  for (int i = 1; i <= n; ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    e.push_back({l, i});
    e.push_back({r + 1, -i});
  }
  sort(e.begin(), e.end());
  for (int msk = 1; msk < (1 << k); ++msk) dp[msk] = -INF;
  for (int i = 0; i < k; ++i) ids[i] = -1;
  for (int it = 0; it < (int)(e.size()); ++it) {
    auto cur = e[it];
    for (int msk = 0; msk < (1 << k); ++msk) ndp[msk] = -INF;
    if (cur.second > 0) {
      int bit = -1;
      for (int i = 0; i < k; ++i) {
        if (ids[i] == -1) {
          bit = i;
          break;
        }
      }
      assert(bit != -1);
      ids[bit] = cur.second;
      for (int msk = 0; msk < (1 << k); msk++) {
        ndp[msk] = max(ndp[msk], dp[msk]);
        if (!(msk & (1 << bit)))
          ndp[(msk ^ (1 << bit))] = max(ndp[(msk ^ (1 << bit))], dp[msk]);
      }
    } else {
      cur.second *= -1;
      int bit = -1;
      for (int i = 0; i < k; ++i) {
        if (ids[i] == cur.second) {
          bit = i;
          break;
        }
      }
      assert(bit != -1);
      ids[bit] = -1;
      for (int msk = 0; msk < (1 << k); msk++)
        if (!(msk & (1 << bit))) {
          ndp[msk] = max(dp[(msk ^ (1 << bit))], dp[msk]);
        }
    }
    dp.swap(ndp);
    if (it + 1 < (int)(e.size())) {
      for (int msk = 0; msk < (1 << k); msk++) {
        if (dp[msk] != -INF && odd[msk]) {
          dp[msk] += e[it + 1].first - e[it].first;
        }
      }
    }
  }
  cout << dp[0] << '\n';
  return 0;
}
