#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x;
  cin >> n;
  long long b = n, i(0), c(0);
  for (int i = n + 1;; i++) {
    b = i;
    if (b < 0) b *= -1;
    while (b != 0) {
      x = b % 10;
      if (x == 8) {
        c = 1;
        break;
      }
      b /= 10;
    }
    if (c == 1) {
      cout << i - n << endl;
      return 0;
    }
  }
  return 0;
}
