#include <bits/stdc++.h>
using namespace std;
template <typename T>
string NumberToString(T pNumber) {
  ostringstream oOStrStream;
  oOStrStream << pNumber;
  return oOStrStream.str();
}
int main() {
  int cfloor = 0;
  cin >> cfloor;
  int n = 0;
  for (long long i = cfloor + 1; i < 8888888888; i++) {
    string str = NumberToString(i);
    size_t found = str.find("8");
    if (found != string::npos) {
      cout << i - cfloor;
      break;
    }
  }
}
