#include <bits/stdc++.h>
using namespace std;
bool is_lucky(int n) {
  if (n < 0) {
    n = -n;
  }
  while (n > 0) {
    int r = n % 10;
    if (r == 8) {
      return true;
    }
    n = n / 10;
  }
  return false;
}
int main() {
  int n;
  cin >> n;
  n++;
  int i = 1;
  while (1) {
    if (is_lucky(n)) {
      cout << i << endl;
      break;
    }
    n++;
    i++;
  }
}
