#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s;
  cin >> s;
  int cntr = 1;
  for (int i = s + 1;; i++) {
    int n, d = 0;
    n = i;
    while (n) {
      d = n % 10;
      n /= 10;
      if (d == 8 || d == -8) {
        cout << cntr << endl;
        return 0;
      }
    }
    cntr++;
  }
}
