#include <bits/stdc++.h>
using namespace std;
void my_file_in_out() {
  freopen("inp.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
}
inline void OK(string t = "") { cerr << "OK " << t << '\n'; }
inline long double time() { return clock() / (long double)CLOCKS_PER_SEC; }
inline void stop(string t = "PROCESS FINISHED") {
  cerr << t << '\n';
  exit(0);
}
const long long M = 998244353;
const int INF = 1e9 + 7;
const long long LINF = 1e15 + 7;
long long bp(long long c, long long st) {
  if (!st) return 1;
  if (st & 1) return (c * bp(c, st - 1)) % M;
  return bp((c * c) % M, st >> 1);
}
mt19937 rnd(time(0));
struct event {
  int pos, id, type;
  event() {}
  event(int pos, int id, int type) {
    this->pos = pos;
    this->id = id;
    this->type = type;
  }
  ~event() = default;
};
signed main() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  vector<event> skanline;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    skanline.push_back({l, i, 1});
    skanline.push_back({r + 1, i, -1});
  }
  sort(skanline.begin(), skanline.end(), [](const event &A, const event &B) {
    if (A.pos != B.pos) return A.pos < B.pos;
    return A.type < B.type;
  });
  int up = (1 << k);
  vector<bool> true_mask(up, false);
  for (int mask = 0; mask < up; mask++)
    true_mask[mask] = bool(__builtin_popcount(mask) & 1);
  vector<vector<int>> dp(2, vector<int>(up, -INF));
  vector<int> get_bit(k, -1);
  dp[0][0] = 0;
  for (int iter = 0; iter < ((int)skanline.size()); iter++) {
    event temp = skanline[iter];
    if (temp.type == 1) {
      int bit = -1;
      for (int j = 0; (bit == -1); j++) {
        if (get_bit[j] == -1) {
          get_bit[j] = temp.id;
          bit = j;
        }
      }
      for (int mask = 0; mask < up; mask++) {
        if ((mask & (1 << bit))) {
          dp[1][mask] = max(dp[1][mask ^ (1 << bit)], dp[0][mask]);
        }
        dp[1][mask] = max(dp[1][mask], dp[0][mask]);
      }
    } else {
      int bit = -1;
      for (int j = 0; (bit == -1); j++) {
        if (get_bit[j] == temp.id) {
          get_bit[j] = -1;
          bit = j;
        }
      }
      for (int mask = 0; mask < up; mask++) {
        if (!(mask & (1 << bit))) {
          dp[1][mask] = max(dp[0][mask ^ (1 << bit)], dp[0][mask]);
        }
      }
    }
    swap(dp[0], dp[1]);
    dp[1].assign(up, -INF);
    if (iter < ((int)skanline.size()) - 1) {
      for (int mask = 0; mask < up; mask++) {
        if (dp[0][mask] != -INF && true_mask[mask]) {
          dp[0][mask] += skanline[iter + 1].pos - temp.pos;
        }
      }
    }
  }
  cout << dp[0][0];
  return 0;
}
