#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  for (int i = 1; i <= 16; ++i) {
    a++;
    stringstream ss;
    ss << a;
    if (ss.str().find_first_of("8") != -1) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}
