#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int f;
  cin >> f;
  for (int a = 1; a <= 10; a++) {
    f = f + 1;
    int d{0};
    if (f != 0) {
      long long int y = f;
      int c{0};
      while (y != 0) {
        if (abs(y) % 10 == 8) {
          d++;
          break;
        }
        y = y / 10;
        c++;
      }
    } else {
      cout << a + 8;
      break;
    }
    if (d == 01) {
      cout << a;
      break;
    }
  }
}
