#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, r;
  bool te = false;
  cin >> a;
  for (long long i = a + 1; i < a + 17; i++) {
    r = i;
    if (r > -8 || r > 0)
      while (r > 0) {
        if (r % 10 == 8 || r % 10 == -8) {
          te = true;
          break;
        }
        r /= 10;
      }
    else if (r < 0) {
      while (r != 0) {
        if (r % 10 == 8 || r % 10 == -8) {
          te = true;
          break;
        }
        r /= 10;
      }
    } else
      cout << 8;
    if (te == true) {
      cout << i - a;
      return 0;
    }
  }
  return 0;
}
