from Queue import * # Queue, LifoQueue, PriorityQueue from bisect import * #bisect, insort from collections import * #deque, Counter,OrderedDict,defaultdict #set([]) import math import copy import itertools import string import sys import datetime myread = lambda : map(int,raw_input().split()) def solver(): d = datetime.date(2015,1,1) ans = 0 while d.year != 2016: day = d.day month = d.month if month == day / 10 + day % 10: ans += 1 d += datetime.timedelta(days=1) print ans if __name__ == "__main__": solver()