#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;
struct Event {
  int pos, idx, end;
  Event(int pos = 0, int idx = 0, int end = 0) : pos(pos), idx(idx), end(end) {}
};
bool operator<(Event a, Event b) {
  if (a.pos == b.pos) return a.end > b.end;
  return a.pos < b.pos;
}
vector<Event> events;
int n, m, k, col[MAXN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cin >> n >> m >> k;
  for (int i = (1); i <= (n); i++) {
    int l, r;
    cin >> l >> r;
    events.push_back(Event(l, i, 0));
    events.push_back(Event(r + 1, i, 1));
  }
  sort(events.begin(), events.end());
  vector<bool> used(k, false);
  for (int i = (0); i <= (int((events).size()) - 1); i++) {
    if (events[i].end) {
      used[col[events[i].idx]] = false;
    } else {
      for (int j = (0); j <= (k - 1); j++)
        if (!used[j]) {
          used[j] = true;
          col[events[i].idx] = j;
          break;
        }
    }
  }
  vector<int> dp(1 << k, -2000000000);
  dp[0] = 0;
  int pre = 0;
  for (int i = (0); i <= (int((events).size()) - 1); i++) {
    vector<int> dp2(1 << k, -2000000000);
    int len = events[i].pos - pre;
    int c = col[events[i].idx];
    for (int mask = (0); mask <= ((1 << k) - 1); mask++)
      if (__builtin_popcount(mask) % 2) dp[mask] += len;
    if (events[i].end) {
      for (int mask = (0); mask <= ((1 << k) - 1); mask++)
        if (!(mask & (1 << c))) dp2[mask] = max(dp[mask], dp[mask ^ (1 << c)]);
    } else {
      for (int mask = (0); mask <= ((1 << k) - 1); mask++)
        if (mask & (1 << c))
          dp2[mask] = dp[mask ^ (1 << c)];
        else
          dp2[mask] = dp[mask];
    }
    pre = events[i].pos;
    swap(dp, dp2);
  }
  cout << dp[0];
  return 0;
}
