now computes average number of gaps