#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k, p = 1, a, b, t, I, bi, K1;
  cin >> n >> m >> k;
  int A[n], B[n], D[2][(1 << k)], K[k], M = 0;
  vector<pair<pair<int, int>, int>> V;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    A[i] = a;
    B[i] = b;
    V.push_back({{a, 1}, i});
    V.push_back({{b + 1, 0}, i});
  }
  for (int i = 0; i < (1 << k); i++) {
    D[0][i] = 0;
    D[1][i] = 0;
  }
  for (int i = 0; i < k; i++) {
    K[i] = -1;
  }
  sort(V.begin(), V.end());
  for (int i = 0; i < V.size(); i++) {
    a = V[i].first.first;
    t = V[i].first.second;
    I = V[i].second;
    for (int y = 0; y < (1 << k); y++) {
      int g = 1;
      for (int u = 0; u < k; u++) {
        if (((1 << u) & y) != 0 && K[u] == -1) {
          g = 0;
          break;
        }
      }
      if (g == 0) {
        D[0][y] = -2000000000;
        D[1][y] = -2000000000;
      } else {
        bi = 0;
        for (int u = 0; u < k; u++) {
          if (((1 << u) & y) != 0 && K[u] != -1) {
            bi++;
          }
        }
        if (bi % 2 == 1) {
          D[0][y] += a - p;
          D[1][y] += a - p;
        }
      }
    }
    p = a;
    if (t == 1) {
      for (int y = 0; y < k; y++) {
        if (K[y] == -1) {
          K[y] = I;
          K1 = y;
          break;
        }
      }
    } else {
      for (int y = 0; y < k; y++) {
        if (K[y] == I) {
          K[y] = -1;
          K1 = y;
          break;
        }
      }
    }
    for (int y = 0; y < (1 << k); y++) {
      int g = 1;
      for (int u = 0; u < k; u++) {
        if (((1 << u) & y) != 0 && (K[u] == -1 && u != K1)) {
          g = 0;
          break;
        }
      }
      if (g == 1) {
        b = ((1 << K1) & y);
        if (t == 1) {
          if (b == 0) {
            D[1][(1 << K1) + y] = max(D[1][(1 << K1) + y], D[0][y]);
          }
        } else {
          if (b != 0) {
            D[1][(y - (1 << K1))] = max(D[1][(y - (1 << K1))], D[0][y]);
          }
        }
      }
    }
    for (int y = 0; y < (1 << k); y++) {
      D[0][y] = D[1][y];
    }
  }
  cout << D[0][0];
  return 0;
}
