#include <bits/stdc++.h>
using namespace std;
bool is_lucky(string a) {
  for (int h = 0; h < a.length(); h++) {
    if (a[h] == '8') return true;
  }
  return false;
}
int main() {
  long int i, pre;
  bool b = false;
  int n = 0;
  cin >> i;
  pre = i;
  do {
    i = i + 1;
    b = is_lucky(to_string(i));
  } while (b == false);
  cout << i - pre;
  return 0;
}
