def main(): N = int(input()) *A, = map(int, input().split()) s = input() t = ''.join(['<' if A[i] < A[i+1] else '>' for i in range(N-1)]) t = t + ('<' if A[-1] < A[0] else '>') + t print(t.find(s)) if __name__ == '__main__': main()