#include <bits/stdc++.h>
using namespace std;
bool check_lucky(long long num) {
  while (num) {
    if ((num % 10) == 8) return 1;
    num /= 10;
  }
  return 0;
}
int main() {
  long long num;
  cin >> num;
  int flag = 0, ans = 1, f2 = 0;
  if (num < 0) {
    flag = 1;
    num *= (-1);
  }
  if (flag) {
    num--;
    while (1) {
      if (num == 0) {
        f2 = 1;
      }
      if (f2) {
        ans++;
        if (!num) {
          num++;
          continue;
        }
        if (check_lucky(num)) {
          cout << ans - 1 << endl;
          return 0;
        }
        num++;
      } else {
        ans++;
        if (check_lucky(num)) {
          cout << ans - 1 << endl;
          return 0;
        }
        num--;
      }
    }
  } else {
    num++;
    while (1) {
      ans++;
      if (!num) continue;
      if (check_lucky(num)) {
        cout << ans - 1 << endl;
        return 0;
      }
      num++;
    }
  }
  cout << ans << endl;
}
