import math


def entropy(data):
    """
    Calculate informational entropy.
    """
    entropy = 0.0
    frequency = {}
    for instance in data:
        p_instance = int(round(instance/5) * 5)
        if p_instance in frequency:
            frequency[p_instance] += 1
        else:
            frequency[p_instance] = 1
        for freq in frequency.values():
            entropy += (-freq/len(data)) * math.log(float(freq)/len(data), 2)
    return entropy