#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long INF = 1e18 + 123;
const long double EPS = 1e-9;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 1e5 + 123;
const int M = 1e6 + 123;
const double pi = 3.14159265359;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
vector<pair<int, int> > ev;
int dp[2][1 << 8], b[N];
bool odd[1 << 8];
vector<int> av;
void relax(int &a, int b) { a = max(a, b); }
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1, l, r; i <= n; i++) {
    cin >> l >> r;
    ev.push_back({l, i});
    ev.push_back({r + 1, -i});
  }
  for (int i = 0; i < k; i++) {
    av.push_back(k - i - 1);
  }
  for (int mask = 0; mask < (1 << k); mask++) {
    for (int i = 0; i < k; i++) {
      odd[mask] ^= mask >> i & 1;
    }
  }
  sort(ev.begin(), ev.end());
  bool t = 0;
  int last = 1;
  memset(dp, -0x3f, sizeof dp);
  dp[0][0] = 0;
  for (auto &[cur, i] : ev) {
    t ^= 1;
    for (int mask = 0; mask < (1 << k); mask++) {
      if (dp[t ^ 1][mask] >= 0) {
        if (odd[mask]) dp[t ^ 1][mask] += cur - last;
      }
      dp[t][mask] = -inf;
    }
    if (0 < i) {
      b[i] = av.back();
      av.pop_back();
      for (int mask = 0; mask < (1 << k); mask++) {
        dp[t][mask] = dp[t ^ 1][mask];
        if (mask >> b[i] & 1) {
          relax(dp[t][mask], dp[t ^ 1][mask ^ (1 << b[i])]);
        }
      }
    } else {
      i = -i;
      av.push_back(b[i]);
      for (int mask = 0; mask < (1 << k); mask++) {
        if (mask >> b[i] & 1) {
          relax(dp[t][mask ^ (1 << b[i])], dp[t ^ 1][mask]);
        } else {
          relax(dp[t][mask], dp[t ^ 1][mask]);
        }
      }
    }
    last = cur;
  }
  cout << dp[t][0];
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
