from itertools import product
s = 'abcdefghijklmnopqrstuvwxyz1234567890.-'
comb = reduce(list.__add__,
(map(''.join,
filter(lambda x: x[0] not in '.-' and x[-1] not in '.-',
product(s, repeat=i))) for i in xrange(1, 5)))
print len(comb)