In the triangle \(ABC\) the segment \(AB=5\) and the segment \(BD\) is the median. The segment \(AE\) is perpendicular to \(BD\) and divides \(BD\) in half. Find the length of \(AC\).