#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<array<int, 3>> evs;
  for (int i = 0; i < n; ++i) {
    int l, r;
    cin >> l >> r;
    evs.push_back({l, 1, i});
    evs.push_back({r + 1, -1, i});
  }
  sort(evs.begin(), evs.end());
  vector<int> old_dp(1 << k);
  set<int> ids;
  map<int, int> bit, p_bit;
  vector<int> in_bit, pin_bit;
  for (int i = 0, cnt = 0; i < 2 * n; ++i) {
    vector<int> dp(1 << k);
    cnt += evs[i][1];
    int deleted = 0;
    if (evs[i][1] == 1) {
      ids.insert(evs[i][2]);
    } else {
      ids.erase(evs[i][2]);
      deleted = 1 << bit[evs[i][2]];
    }
    bit.clear();
    in_bit.clear();
    int c_bit = -1;
    for (int id : ids) {
      bit[id] = ++c_bit;
      in_bit.push_back(id);
    }
    for (int mask = 0; mask < (1 << cnt); ++mask) {
      int old_mask = 0;
      for (int b = 0; b < cnt; ++b) {
        if (mask >> b & 1) {
          if (p_bit.count(in_bit[b])) {
            old_mask ^= 1 << p_bit[in_bit[b]];
          }
        }
      }
      dp[mask] = max(old_dp[old_mask], old_dp[old_mask ^ deleted]);
      if (__builtin_popcount(mask) % 2 && i + 1 < 2 * n) {
        dp[mask] += evs[i + 1][0] - evs[i][0];
      }
    }
    p_bit = bit;
    pin_bit = in_bit;
    old_dp = dp;
  }
  cout << *max_element(old_dp.begin(), old_dp.end()) << endl;
}
