#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long f, res = 0;
  cin >> f;
  while (1) {
    f++;
    res++;
    long long ff = abs(f);
    while (ff > 0) {
      int d = ff % 10;
      if (d == 8) {
        cout << res << "\n";
        return 0;
      }
      ff /= 10;
    }
  }
  return 0;
}
