#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  int count = 0;
  for (int i = 0; i <= 100; i++) {
    int last_digit = n % 10;
    if (abs(last_digit) == 8) {
      if (count != 0) {
        cout << count << endl;
        break;
      }
    } else {
      long long remain = abs(n / 10);
      while (remain > 0) {
        if (abs(remain % 10) == 8 && count != 0) {
          cout << count << endl;
          exit(0);
        }
        remain /= 10;
      }
    }
    n++;
    count++;
  }
  return 0;
}
