#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int temp, cnt = 0;
  bool flag = 1;
  while (flag) {
    temp = ++n;
    cnt++;
    while (temp) {
      if (temp % 10 == 8 || temp % 10 == -8) {
        flag = 0;
        break;
      }
      temp /= 10;
    }
  }
  cout << cnt << endl;
  return 0;
}
